This article explains how to insert data into your DEXCell Energy Manager account through an HTTP/JSON API.
So, how do you get started?
- Ok, first things first...let's create a gateway. A Gateway is the object inside DEXCell Energy Manager where you can introduce data, so you need to have at least one in your account if you want to upload some energy readings.
- Now it's time to get the Gateway MAC and the Gateway token to use them in to the insertion query. Both strings are located in the gateway configuration page.
Sending data to DEXCell Energy Manager
Method: HTTP POST
- source_key: Mandatory param. Is the MAC address of the gateway or the unique key that identifies the datasource which the data belongs to.
- dexcell_source_token: the authentication token for every gateway. Token is used as an extra safety layer and can be revoked by DEXMA if needed. It can be used as a URL parameter or in the request header.
- x-dexcell-source-token: the authentication token, mentioned before in the URL params.
- Content-Type: application/json;charset=utf-8
The body of the http message should contain the collection(array) of message than you want to insert.
The message structure is the following:
- “did” : String // max 25 chars; local ID of the device
- “sqn”: Integer // Number of the message; → Used internally as readings control. It should be incremental starting from one. If you can't send it, set it to "1".
- “ts”: String // Date format based on the Standard ISO 8601, the available formats are:
- YYYY-MM-DDTHH:MM:SSZ → 2014-11-28T17:14:00Z
- YYYY-MM-DDTHH:MM:SS+HH:MM → 2014-11-28T17:14:00+02:00
- YYYY-MM-DDTHH:MM:SS-HH:MM → 2014-11-28T17:14:00-02:00
- If you want to put local time you should add the offset depend the timezone of your location.
- “values”: Collection/Array // Contains all the readings with its parameterid and its respective value, the structure is the following:
- “p”: Integer // Parameter ID of the type of data contained; refer to DEXCell Energy Manager Parameters
- “v”: Float // value of the reading
Example 1: Sending cumulative data to DEXCell Energy Manager
This example shows how to insert active energy cumulated data to the device "3" of the gateway "123456789".
According to the parameters list, the data needs to be introduced in the 402 parameter.
URL and header:
Example 2: Sending interval data to DEXCell Energy Manager
This example shows how to insert half hourly active energy data to the device "5" of the gateway "123456789".
According to the parameters list, the data needs to be introduced in the 40261 parameter.
URL and header:
Important Note: For interval data, DEXCell Energy Manager uses the convetion of plotting the energy consumed during the interval in the first time stamp. For example, from 20:00h to 20:30h the energy consumed is 52 kWh, the data should be introduced in the 20:00h time stamp.
Example 3: Sending instantaneous data to DEXCell Energy Manager
This example shows how to insert instantaneous data such as temperature (301) or power (401) to the device "7" of the gateway "123456789".
URL and header:
For any further assistance, please contact with email@example.com