Record Measurements via API
This is a quick tutorial that will show you how you can use the Datacake GraphQL-API to record measurement values into your devices.
There is a large overview of Endpoints and how they function including some examples on an external developer overview.
Record Multiple Values at once
Payload Structure
Make sure that you structure the payload like in the following snippet.
[
{"field": "WATT", "value": msg.payload.watt },
{"field": "AMPERE", "value": msg.payload.ampere},
{"field": "VOLT", "value": msg.payload.volt}
];So the general structure is:
[{"field":"field1", "value":123.00}, {"field":"field2", "value":"a string"}]URL
The URL you should use for recording multiple measurements at once is:
https://api.datacake.co/v1/devices/22h7c45f-2917-358-9db1-d8a544ab78ed/record/?batch=true
It is structured as follow:
https://api.datacake.co/v1/devices/<<device-id>>/record/?batch=true
The Device-Id (<<device-id>>)
This is the ID of your Device. You find this in the URL of the Datacake Portal and on the Device-View.

Rate Limiting
Per default the Datacake GraphQL-API has an internal rate limiting of 1 write per second and per field. If you want to record historical data this might be an issue.
Examples
Here you find some Examples that show you how to record multiple measurements.
Curl
Javascript
Python
Last updated
Was this helpful?