Follow

POST Data to DECK via API

Initial Setup

  1. Contact DECK Monitoring support to request an incoming API username and password for your company.
  2. If sending data to an existing device, support can help you find the unique name of the device you would like to send data to, and the data fields that are mapped.
  3. If creating a new device, the first call to the API will create the device and create the table to store the data. Take care to include all data fields this device will ever receive. It is not possible to add a data field to an existing device.

URL

http://api.deckmonitoring.com/

Authentication

This service requires standard HTTP authentication. DECK will provide you with the username and password to use.

Request

A POST request with a payload JSON hash or array of hashes containing the data and an optional config parameter.

Payload hash required keys

device: A unique identifier for the device. This can be any string or number as long as it is unique to the devices within your company. The first call to the incoming API with a new device will create the device with the data fields provided. It is important to submit all the data fields for the device in the first call. If the company has multiple locations and location is not specified, the device will be added to the most recently created location.

time: A string provided in the ISO 8601 XML schema format or as a Unix timestamp.  All times must be in UTC. Example: 2010-05-31T10:23:12UTC

data: A hash of key-value pairs. Keys must remain the same through the life of the system. Any key may be used. Suggested examples are: "energy_generated_kwh", "energy_used_kw", "temperature".

Example Payload

payload=
[
{
   "device": "acme_weather_meter",
   "time": "2010-05-31T10:23:12UTC",
   "data": {
   "temp": 12.42,
  "humidity": 0.06
}
},
{
  "device": "acme_weather_meter",
  "time": "2010-05-31T10:24:16UTC",
  "data": {
  "temp": 12.39,
   "humidity": 0.07
}
},
{
  "device": "acme_pv_south_arry",
  "time": "2010-05-31T09:10:11UTC",
  "data": {
  "kw": 2.4232,
"kwh": 12332.57
}
}
]

Optional Config Block

An optional config parameter can be passed in the request specifiying the API version and the location that the new devices should be created on.

Example Config Block

config = {
"version": 1,
"location_id": 12345
}

Response


Successfully logged data will return a JSON response with a success message.

{ "success": true }


A failed response will return an error similar to the following or a 500 server error.

{
"success": "false",
"error": {
"type": "format",
"message": "The request was not formatted in proper JSON."
}
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk