Skip to content

Update datavalue in datasource

Single value

We don't currently have a update endpoint for single datavalue

To update datavalue you must delete the value and then add a new value

Datavalues are typically inserted in larger batches, therefore it's usually simpler to delete the batch and post all from their source instead of having to carefully update single values.

For this purpose we have batch methods in addition to single value methods.

Delete then post batch

You can delete an array of ids with Datavalue batch delete

http
DELETE https://connect.digilean.tools/v1/Datasources/{id}/values/batch 
Content-Type: application/json

[1001,1002,1003]

Then insert batch with Datavalue post batch

http
POST https://connect.digilean.tools/v1/Datasources/{id}/values/batch 
Content-Type: application/json

[
  {
    "valueDate": "2024-10-25T12:00:00",
    "value": 1
  },
  {
    "valueDate": "2024-10-26T12:00:00",
    "value": 2
  },
  {
    "valueDate": "2024-10-27T12:00:00",
    "value": 3
  }
]

Batch replace

If you are working with a specific time period of datavalues it can be convenient to use Datavalue batch replace

This method accepts a body of new Datavalues and Datetime From - To URL parameters.

It will first delete all values in the time period (valueDate) and then insert the new values

http
PUT https://connect.digilean.tools/v1/Datasources/{id}/values/batchReplace
?from=2024-12-24T00:00:00Z
&to=2024-12-26T00:00:00Z 
Content-Type: application/json

[
  {
    "valueDate": "2024-12-24T12:00:00",
    "value": 1
  },
  {
    "valueDate": "2024-12-25T12:00:00",
    "value": 2
  }
]