...
The location is returned:
Code Block |
---|
{ "url": "https://api.ddsc.nl/api/v2/locations/73fd0765-86fb-40b9-a917-ecb59f5dc14b/" "uuid": "73fd0765-86fb-40b9-a917-ecb59f5dc14b" "name": "28_5" "organisation": "a73d02c3280047a89d4d362df1914352" "organisation_code": "28_5" "geometry": null "access_modifier": "Public" "ddsc_icon_url": "" "ddsc_show_on_map": false "extra_metadata": null "last_modified": "2016-02-19T16:01:17.699333" "last_modified_by": "deltares_ddsc" } |
Creating a new timeseries for storing events"
Code Block |
---|
POST https://api.ddsc.nl/api/v2/timeseries/ Host: api.ddsc.nl username: ddsc_username password: ddsc_password Content-Type: application/json Accept: application/json { "name": "timeserie_28_0", "description": "timeserie_28_0", "location": "b8db040c-4edc-4983-81df-32b2f3216bfc", "organisation_code": "timeserie_28_0", "device": "", "supplier": null, "supplier_code": null, "access_modifier": "Public", "value_type":1, "parameter_referenced_unit": "H.meting", "threshold_min_soft": null, "threshold_min_hard": null, "threshold_max_soft": null, "threshold_max_hard": null } |
The result of this post returns the uuid of this timeseries.
Code Block |
---|
{ "url": "https://api.ddsc.nl/api/v2/timeseries/414c320b-d965-4888-8b9c-cf587a82dacb/" "id": 40314 "uuid": "414c320b-d965-4888-8b9c-cf587a82dacb" "name": "timeserie_28_0" "description": "timeserie_28_0" "location": "b8db040c-4edc-4983-81df-32b2f3216bfc" "organisation_code": "timeserie_28_0" "device": "" "supplier": null "supplier_code": null "access_modifier": "Public" "value_type": "float" "parameter_referenced_unit": "H.meting" "threshold_min_soft": null "threshold_min_hard": null "threshold_max_soft": null "threshold_max_hard": null "last_modified": "2016-02-19T16:20:56.768927" "last_modified_by": "deltares_ddsc" "extra_metadata": null } |
Posting events to the timeseries is done by the DdscExport module, but can be done manually as well with:
POST https://api.ddsc.nl/api/v2/timeseries/f9295f20-de55-40d4-a356-61f6f142a36f/data/
Where f9295f20-de55-40d4-a356-61f6f142a36f is the uuid of the timeseries.
The POST content can be JSON according the following format:
Code Block |
---|
[ {"value": "2.0123", "datetime": "2013-02-12T09:56:12Z"}, {"value": "2.0123", "datetime": "2013-02-13T09:56:12Z"} ] |
This will return the following response:
Code Block |
---|
[{"datetime":"2013-02-12T09:56:12Z","value":"2.0123"},{"datetime":"2013-02-13T09:56:12Z","value":"2.0123"}] |
For posting images to image DDSC a new timeseries of value type 5 has to be created where the uuid of the location is specified. This way they can be related to each other.
Creating an "image" time series can be done as follows:
Code Block |
---|
POST https://api.ddsc.nl/api/v2/timeseries/ Host: api.ddsc.nl username: ddsc_username password: ddsc_password Content-Type: application/json Accept: application/json { "name": "timeserie_image_28_0", "description": "timeserie_28_0", "location": "b8db040c-4edc-4983-81df-32b2f3216bfc", "organisation_code": "timeserie_image_28_0", "device": "", "supplier": null, "supplier_code": null, "access_modifier": "Public", "value_type":5, "parameter_referenced_unit": "H.meting", "threshold_min_soft": null, "threshold_min_hard": null, "threshold_max_soft": null, "threshold_max_hard": null } |
The uuid of this series is returned in the response:
Code Block |
---|
{ "url": "https://api.ddsc.nl/api/v2/timeseries/9d7dbcdc-e6a7-41e9-8870-eacdf80e18fc/" "id": 40315 "uuid": "9d7dbcdc-e6a7-41e9-8870-eacdf80e18fc" "name": "timeserie_image_28_0" "description": "timeserie_28_0" "location": "b8db040c-4edc-4983-81df-32b2f3216bfc" "organisation_code": "timeserie_image_28_0" "device": "" "supplier": null "supplier_code": null "access_modifier": "Public" "value_type": "image" "parameter_referenced_unit": "H.meting" "threshold_min_soft": null "threshold_min_hard": null "threshold_max_soft": null "threshold_max_hard": null "last_modified": "2016-02-19T16:23:46.071265" "last_modified_by": "deltares_ddsc" "extra_metadata": null } |
Storing Images in the DDSC is done by the DDSC Export module.
Images can now be posted manually as well to:
POST https://api.ddsc.nl/api/v2/timeseries/(uuid: uuid)/data/
In the header user name and password should be specified and datetime header as well. Only one image per datetime can be posted. Here an example with curl.
Code Block |
---|
curl -X POST -H "Accept: application/json" -H 'username: username' -H 'password: password' -H 'Content-Type: image/jpg' -H 'datetime: 2016-02-22T11:18:38.683Z' --data-binary "@plaatje.jpg" http://api.ddsc.nl/api/v2/timeseries/3d43f739-bb6f-459c-a089-7ec1f13d4fb3/data/ |