DevicePilot has a simple REST API for POSTing device data. You post a JSON body of properties, to
"label": "My sensor",
We use token authentication so you'll need to supply two headers to the POST:
"Authorization: Token xxxxyyyyzzzz"
Your API key can be found in the user settings page.
Your device objects may contain any properties you like, so long as they do not begin with $. The $ symbol is reserved for DevicePilot system properties, some of which you can pass in to describe your data. These include:
If you'd like to send us some JSON you already have, that uses different field names, you can tell us about that in the URL. The following query parameters are supported:
DevicePilot doesn't differentiate between creating and updating devices - just POST the data and we'll "create" devices as new $ids are seen. Also, you don't need to send all properties everytime - you can if you like but the most efficient way is to send us only what's changed.
DevicePilot supports POSTing an array of JSON objects to update multiple devices at once. You can most a maximum of 500 records or 1Mb of data, whichever is smaller. Unless you have dozens and dozens of properties, you'll likely hit the 500 record limit first.
Batch POSTing is recommended as more efficient than individual POSTs.
DevicePilot is eventually consistent, so we return 202 on Accepting the POST.
We return 400 on bad arguments i.e. if any of the rules above not met. The body will have a detailed explanation of the error, so this should help you understand what went wrong.
Other codes returned: