Support Center

HTTP/JSON API (data insertion)

Last Updated: Feb 24, 2016 01:24PM CET

This article explains how to insert data into your DEXCell Energy Manager account through an HTTP/JSON API. 
 

So, how do you get started?

 
  1. 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. 
  1. 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

 

URL Parameters

 

URL Example:

 http://is3.dexcell.com/readings?source_key=mac-123456789&dexcell_source_token=123456789


Host: is3.dexcell.com

Port: 80
Path: /readings
Method: HTTP POST
URL Params:

  • 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.
 

Request Header

 

Header example:

x-dexcell-source-token: 123456789
Content-Type: application/json;charset=utf-8​
  • x-dexcell-source-token: the authentication token, mentioned before in the URL params.
  • Content-Type: application/json;charset=utf-8​


Message structure

​The body of the http message should contain the collection(array) of message than you want to insert.

[{
     "did":"3a",
     "sqn":1,
     "ts":"2014-10-02T10:30:00+02:00",
     "values":[
        {
           "p":401,
           "v":3505
        },
        {
           "p":402,
           "v":5600012
        },
        {
           "p":404,
           "v":123504
        }
     ]
  },
{ ... },
{ ... }
]
​​
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:


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 only:
http://is3.dexcell.com/readings?source_key=mac-123456789&dexcell_source_token=123456789

URL and header:
http://is3.dexcell.com/readings?source_key=mac-123456789
x-dexcell-source-token:123456789

Body message: 
[{
     "did":"3",
     "sqn":1,
     "ts":"2014-10-02T10:30:00+00:00",
     "values":[
        {
           "p":402,
           "v":1250.0
        }
        ]
  },
  {
     "did":"3",
     "sqn":2,
     "ts":"2014-10-02T10:45:00+00:00",
     "values":[
        {
           "p":402,
           "v":1280
        }
        ]
  },
  {
     "did":"3",
     "sqn":3,
     "ts":"2014-10-02T11:00:00+00:00",
     "values":[
        {
           "p":402,
           "v":1298.3
        }
        ]
  }
]
 


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 only:

http://is3.dexcell.com/readings?source_key=mac-123456789&dexcell_source_token=123456789

URL and header:
http://is3.dexcell.com/readings?source_key=mac-123456789
x-dexcell-source-token:123456789

Body message:

[{
     "did":"5",
     "sqn":1,
     "ts":"2014-10-02T10:30:00+00:00",
     "values":[
        {
           "p":40261,
           "v":30.0
        }
        ]
  },
  {
     "did":"5",
     "sqn":2,
     "ts":"2014-10-02T10:45:00+00:00",
     "values":[
        {
           "p":40261,
           "v":18.3
        }
        ]
  }
]

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 only:

http://is3.dexcell.com/readings?source_key=mac-123456789&dexcell_source_token=123456789

URL and header:
http://is3.dexcell.com/readings?source_key=mac-123456789
x-dexcell-source-token:123456789

Body message:

[{
     "did":"7",
     "sqn":1,
     "ts":"2014-10-02T10:30:00+00:00",
     "values":[
        {
           "p":301,
           "v":25.2
        },
        {
           "p":401,
           "v":2540
        }
        ]
  },
  {
     "did":"7",
     "sqn":2,
     "ts":"2014-10-02T10:45:00+00:00",
     "values":[
        {
           "p":301,
           "v":25.8
        },
        {
           "p":401,
           "v":1890
        }
        ]
  }
]
 

For any further assistance, please contact with support@dexmatech.com

Contact Us

  • Post a Public Question
  • Email Us
  • Tel : +34 931 810 195
    Hours: 9am - 6pm CEST, Mon to Fri
    support@dexmatech.com

    Check Public holidays here

    Support
soporte@dexmatech.com
http://assets0.desk.com/
false
dexma
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete