Scroll down to learn more

Documentation Center

Welcome to Opinum Documentation Center. You find here all the content you need to enjoy your data.

Search Results for

    Show / Hide Table of Contents

    Delete data in Datahub

    This feature allows to delete data stored in Data Hub.

    Overview

    Data in Datahub is stored as entities called datapoints. A datapoint is an object containing a DateTime and a Value. These objects are, in turn, stored in variables.

    The API endpoint DELETE/data allows to delete datapoints in a defined range of time and for a list of variables, by using the HTTP DELETE verb.

    This feature is only available through the Rest API. Deleting datapoints is currently not possible through the UI.

    Warning

    Once deleted, the datapoints cannot be recovered. Hence, this feature should be used with extreme caution. Note that you can use the whatIf mode to check the result of the operation without executing it.

    Delete Request

    Below is an example of the request body :

    {
      "variableIds": [
        0
      ],
      "fromDateUtc": "2021-03-29T07:04:03.433Z",
      "toDateUtc": "2021-03-29T07:04:03.433Z",
      "whatIf": true
    }
    

    Variable Ids

    Mandatory. List of ids identifying the variables for which the datapoints will be deleted. At least one id must be provided.

    The delete data request can be applied to both raw and calculated variables.

    Please, note that the deletion of a datapoint stored in a calculated variable will not trigger the recomputation of this calculated variable.

    The same goes if the datapoint is stored in a variable that is used in a calculated variable.

    From and To Date

    Indicates a dateTime range for which datapoints should be deleted, in UTC. Otherwise, an offSet can be specified. See the example below.

    FromDateUtc

    Start time from which to apply the deletion.

    Inclusive : if the dateTime of a datapoint equals the fromDateUtc, this datapoint will be deleted.

    Warning

    If no fromDateUtc specified, all datapoints existing before the toDateUtc will be deleted.

    ToDateUtc

    End time up to which to apply the deletion.

    Exclusive : if the dateTime of a datapoint equals the To date, this datapoint will not be deleted.

    Warning

    If no toDateUtc specified, all datapoints existing after the fromDateUtc (included) will be deleted.

    Delete all datapoints of one or several variables

    It is possible to delete all datapoints stored in a variable (or several variables) by omitting both the fromDateUtc and the toDateUtc.

    Warning

    Once deleted, the datapoints cannot be recovered.

    WhatIf Mode

    When set to true, allows to see the result of the request without effectively executing the deletion.

    Warning

    Use this option ("whatIf": true) to ensure that your delete request works as expected before running it with whatIf set to false.

    Delete Response

    Below is an example of the response body :

    {
      "results": [
        {
          "variableId": 0,
          "datapointCount": 0,
          "minDate": "2021-03-29T07:04:03.485Z",
          "maxDate": "2021-03-29T07:04:03.485Z",
          "isSuccessful": true,
          "errors": "string"
        }
      ]
    }
    

    For each variable specified in the delete request (to which the current user has access to), an object will be created in the results array.

    This object contains the following properties:

    • variableId : indicates the variable to which the delete has been applied,
    • datapointCount : the number of datapoints deleted for this variable,
    • minDate : the dateTime of the first datapoint deleted for this variable,
    • maxDate : the dateTime of the last datapoint deleted for this variable,
    • isSuccessful: boolean which indicates if the delete request has been successful for the current variable or not,
    • errors: displays the errors encountered during the delete action.

    Examples of requests

    Case 1 : WhatIf Mode

    {
      "variableIds": [
        1234, 5678, 9101
      ],
      "fromDateUtc": "2020-12-29T01:00:00.000Z",
      "toDateUtc": "2021-03-09T07:00:00.000Z",
      "whatIf": true
    }
    

    Simulates the deletion for datapoints found in the variables "1234", "5678" and "9101" and with a dateTime between 2020-12-29T01:00:00.000Z (included) and 2021-03-09T07:00:00.000Z (excluded). No data will be deleted.

    Case 2 : From and To Dates in UTC

    {
      "variableIds": [
        1234, 5678, 9101
      ],
      "fromDateUtc": "2020-12-29T01:00:00.000Z",
      "toDateUtc": "2021-03-09T07:00:00.000Z",
      "whatIf": false
    }
    

    All datapoints found in the variables "1234", "5678" and "9101" and with a dateTime between 2020-12-29T01:00:00.000Z (included) and 2021-03-09T07:00:00.000Z (excluded) will be deleted.

    Case 3 : From and To dates with offSet

    {
      "variableIds": [
        1234, 5678, 9101
      ],
      "fromDateUtc": "2020-12-29T01:00:00.000+01:00",
      "toDateUtc": "2021-03-09T07:00:00.000+01:00",
      "whatIf": false
    }
    

    All datapoints found in the variables "1234", "5678" and "9101" and with a dateTime between 2020-12-29T00:00:00.000Z (included) and 2021-03-09T06:00:00.000Z (excluded) will be deleted.

    Case 4 : From date only

    {
      "variableIds": [
        1234, 5678, 9101
      ],
      "fromDateUtc": "2020-12-29T01:00:00.000Z",
      "whatIf": false
    }
    

    All datapoints found in the variables "1234", "5678" and "9101" and with a dateTime equals to or after 2020-12-29T01:00:00.000Z will be deleted.

    Case 5 : To date only

    {
      "variableIds": [
        1234, 5678, 9101
      ],
      "toDateUtc": "2021-03-09T07:00:00.000Z",
      "whatIf": false
    }
    

    All datapoints found in the variables "1234", "5678" and "9101" and with a dateTime before 2020-12-29T01:00:00.000Z (excluded) will be deleted.

    Case 6 : No dates

    {
      "variableIds": [
        1234, 5678, 9101
      ],
      "whatIf": false
    }
    

    All datapoints found in the variables "1234", "5678" and "9101" will be deleted.

    Rights and Access

    To delete datapoints stored in a variable, the user must

    • either be a manager of the account
    • or be a user with
      • the rights 'Admin' for the feature 'Sources' AND
      • access to the source to which the variable is linked.

    Datapoints stored in variables linked to a source shared among different accounts cannot be deleted.

    Note

    Learn more about user management.

    Developer Center

    User manual API Swagger Github
    © Opinum 2025  -   www.opinum.com

    Follow us

    Linkedin Twitter Youtube Facebook