Jetlun REST Web Service Interface

REST API: Device Management

Send command to gateway

Description: Send Command to Gateway

Method: POST

Arguments: myjetlun_id, mac, device_id, type, api_key, timestamp, sign, format

Format: JSON, XML

Base URL: "http://api.myjetlun.com/v1/services/gateway/command "

This API will require a corresponding Content-Type header (set to "application/json" or "application/xml").

Curl example:

curl -X POST http://api.myjetlun.com/v1/services/gateway/command \
-H 'Content-Type: application/json' \

-d '{"control":{"timestamp":"20120606114216","mac":"C8D2C1000470","api_key":"99918776","sn":"c8d2c300000000500000000000000000","io":"On","type":"Appliance Module","myjetlun_id":"4e7164c569eccc2d8b000546","sign":"584a01817441a87f14a6523faa26e3f9"}}'

Example post json body:

Appliance Module:

{"control":{"timestamp":"20120606114216","mac":"C8D2C1000470","api_key":"99918776",

"sn":"c8d2c300000000500000000000000000","io":"[On|Off]","type":"Appliance Module",

"myjetlun_id":"4e7164c569eccc2d8b000546", "sign":"584a01817441a87f14a6523faa26e3f9"}}
		        

Appliance Module Plus:

{"control":{"timestamp":"20120606114216","mac":"C8D2C1000470","api_key":"99918776",

"sn":"c8d2c300000000500000000000000000", "opt":"normal", "Relay1":"[On|Off]", 

"Relay2":"[On|Off]","type":"Appliance Module Plus",

"myjetlun_id":"4e7164c569eccc2d8b000546", "sign":"584a01817441a87f14a6523faa26e3f9"}}
		        

Relay Module:

{"control":{"timestamp":"20120606114216","mac":"C8D2C1000470","api_key":"99918776",

"sn":"c8d2c300000000500000000000000000","io":"[On|Off]","type":"Relay Module",

"myjetlun_id":"4e7164c569eccc2d8b000546", "sign":"584a01817441a87f14a6523faa26e3f9"}}
		        

Thermostat:

Notice: cooling point and heating point must be Celsius (ºC).
{"control":{"timestamp":"20120606114216","mac":"C8D2C1000470","api_key":"99918776",

"sn":"c8d2c300000000500000000000000000", "mode":"[Auto|Cool|Heat|Off]", 

"cooling point":"21.0", "heating point":"22.0", "fan":"[On|Auto]","type":"Thermostat",

"myjetlun_id":"4e7164c569eccc2d8b000546", "sign":"584a01817441a87f14a6523faa26e3f9"}}
		        

Infrared Sensor:

{"control":{"timestamp":"20120606114216","mac":"C8D2C1000470","api_key":"99918776",

"sn":"c8d2c300000000500000000000000000","io":"[On|Off]", "code":"[1|2|3|4]",

"type":"Infrared Sensor","myjetlun_id":"4e7164c569eccc2d8b000546", 

"sign":"584a01817441a87f14a6523faa26e3f9"}}
		        

Light Dimmer:

{"control":{"timestamp":"20120606114216","mac":"C8D2C1000470","api_key":"99918776",

"sn":"c8d2c300000000500000000000000000","dimming":"[1-100]","type":"Light Dimmer",

"myjetlun_id":"4e7164c569eccc2d8b000546", "sign":"584a01817441a87f14a6523faa26e3f9"}}
		        

Example post xml body:

Appliance Module:

<xml> <control> <api_key>99918776</api_key> <timestamp>20120606114216</timestamp> <sign>584a01817441a87f14a6523faa26e3f9</sign> <myjetlun_id>4e7164c569eccc2d8b000546</myjetlun_id> <mac>C8D2C1000470</mac> <sn>c8d2c300000000500000000000000000</sn> <type>Appliance Module</type> <io>On</io> </control></xml>

Appliance Module Plus:

<xml> <control> <api_key>99918776</api_key> <timestamp>20120606114216</timestamp> <sign>584a01817441a87f14a6523faa26e3f9</sign> <myjetlun_id>4e7164c569eccc2d8b000546</myjetlun_id> <mac>C8D2C1000470</mac> <sn>c8d2c300000000500000000000000000</sn> <type>Appliance Module</type> <opt>normal</opt> <Relay1>On</Relay1> <Relay2>Off</Relay2> </control></xml>

Relay Module:

<xml> <control> <api_key>99918776</api_key> <timestamp>20120606114216</timestamp> <sign>584a01817441a87f14a6523faa26e3f9</sign> <myjetlun_id>4e7164c569eccc2d8b000546</myjetlun_id> <mac>C8D2C1000470</mac> <sn>c8d2c300000000500000000000000000</sn> <type>Relay Module</type> <io>On</io> </control></xml>

Thermostat:

<xml> <control> <api_key>99918776</api_key> <timestamp>20120606114216</timestamp> <sign>584a01817441a87f14a6523faa26e3f9</sign> <myjetlun_id>4e7164c569eccc2d8b000546</myjetlun_id> <mac>C8D2C1000470</mac> <sn>c8d2c300000000500000000000000000</sn> <type>Thermostat</type> <mode>auto</mode> <cooling_point>21.6</cooling_point> <heating_point>22.6</heating_point> <fan>auto</fan> </control></xml>

Infrared Sensor:

<xml> <control> <api_key>99918776</api_key> <timestamp>20120606114216</timestamp> <sign>584a01817441a87f14a6523faa26e3f9</sign> <myjetlun_id>4e7164c569eccc2d8b000546</myjetlun_id> <mac>C8D2C1000470</mac> <sn>c8d2c300000000500000000000000000</sn> <type>Infrared Sensor</type> <code>1</code> <io>On</io> </control></xml>

Light Dimmer:

<xml> <control> <api_key>99918776</api_key> <timestamp>20120606114216</timestamp> <sign>584a01817441a87f14a6523faa26e3f9</sign> <myjetlun_id>4e7164c569eccc2d8b000546</myjetlun_id> <mac>C8D2C1000470</mac> <sn>c8d2c300000000500000000000000000</sn> <type>Light Dimmer</type> <dimming>50</dimming> </control></xml>

Example Response:

{
“status”:“success”
}