ADAM-3600 RESTful Specification
ADAM-3600 RESTful Specification
An.Xin
2018-4-23
RECORD OF CHANGES
Version Date Chapter Description Reviser
1.0 2015-1-14 Initial Version. An Xin
1.1 2015-6-01 Ver.1.1 An Xin
1.2 2015-9-21 Ver.1.2 An Xin
1.3 2016-11-18 Ver.1.3 An Xin
1.4 2017-08-23 Ver1.4 An.Xin
1.5 2018-04-23 Ver1.5 An.Xin
Content
1 Web Service Uniform Interface................................................................................................. 4
1.1 RESTful Web Service Uniform Interface...................................................................... 4
1.2 GET ............................................................................................................................... 4
1.3 PUT ............................................................................................................................... 4
1.4 PATCH .......................................................................................................................... 4
1.5 POST ............................................................................................................................. 5
1.6 Safe and Idempotent...................................................................................................... 5
1.7 HTTPS Response Status-Code ...................................................................................... 5
2 Web Service API Definition ...................................................................................................... 7
2.1 URLOverview ............................................................................................................... 7
2.2 Device Information ....................................................................................................... 9
2.3 Device Control ............................................................................................................ 13
2.3.1 Restart ............................................................................................................. 13
2.3.2 Calibration ....................................................................................................... 13
2.4 Analog Input ............................................................................................................... 16
2.5 Analog output.............................................................................................................. 21
2.6 Digital input ................................................................................................................ 24
2.7 Digital output .............................................................................................................. 27
2.8 Tag Information ........................................................................................................... 31
2.8.1 System Tag - Data Acquisition ........................................................................ 31
2.8.2 User Tag/IO Tag/Calc Tag - Data Acquisition ................................................. 34
2.9 Data Logger................................................................................................................. 40
2.10 Log in/log out .............................................................................................................. 44
2.10.1 Log in .............................................................................................................. 44
2.10.2 Log out ............................................................................................................ 44
2.11 Image Update .............................................................................................................. 46
2.11.1 Image Upload .................................................................................................. 46
2.11.2 Image Update .................................................................................................. 47
2.11.3 Get information in update process .................................................................. 48
2.11.4 Image version information .............................................................................. 48
2.12 System log file ............................................................................................................ 50
Get syslog of device ........................................................................................................ 50
2.13 Network....................................................................................................................... 52
1 Web Service Uniform Interface
1.2 GET
The GET method means retreive whatever information (in the form of an entity) is identified by
the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data
which shall be returned as the entity in the response and not the source text of the process, unless
that text happens to be the output of the process.
1.3 PUT
PUT can be used when the client is sending data to the the server and the client is determining the
URI for the newly created resource.
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be
considered as a modified version of the one residing on the origin server. If the Request-URI
does not point to an existing resource, and that URI is capable of being defined as a new
resource by the requesting user agent, the origin server can create the resource with that
URI.
1.4 PATCH
RFC5786 defines the new HTTP/1.1 [RFC2616] method, PATCH, which is used to apply partial
modifications to a resource.
PATCH can be used when the client is sending one or more changes to be applied by the the
server.
The PATCH method requests that a set of changes described in the request entity be applied
to the resource identified by the Request-URI. The set of changes is represented in a format
called a "patch document"...
The point is that PATCH is used to doing some kind of 'partial' update.
1.5 POST
POST can be used when the client is sending data to the server and the server will decide the URI
for the newly created resource.
"The POST method is used to request that the origin server accept the entity enclosed in the
request as a new subordinate of the resource identified by the Request-URI in the
Request-Line."
This is what most of us think of when we talk about "creating data" on a web server.
Safe? Idempotent?
GET Y Y
POST N N
PATCH N N
PUT N Y
DELETE N Y
- 3xx: Redirection - Further action must be taken in order to complete the request
- 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently valid request
The status codes supported by ADAM web server are described below.
Status-Code Reason-Phrase Conditions
The request succeeded, and that the requested
200 OK information is in the response.
This is the most common status code to receive.
The request could not be understood by the server due
to malformed syntax..
The value in Content-length header does not
400 Bad Request
match with the real data length.
Invalid JOSN objects or format.
Invalid multipart contents.
The server refuses to fulfill the request due to
403 Forbidden
authentication error, such as invalid cookie.
The requested resource (URI) does not exist on the
404 Not Found
server.
Method Not The request method (POST or GET) is not allowed on
405
Allowed the requested resource.
411 Length Required The required Content-length header is missing.
Memory access errors occurred on the server when
Internal Server processed the file uploaded by client.
500
Error Fail to reply the JSON-format message due to out of
buffer size, or others.
Service The login list is full.
503
Unavailable
2 Web Service API Definition
2.1 URLOverview
HTTP Methods
URI Description Applicable
GET PUT PATCH POST
/ data The entry URI for user’s HTML
/sys/log_in Log in for update data
/sys/log_out Log out
/sys/version Get all versions on device
/sys/upload Upload files for update
/sys/update Firmware update
/sys/update_info Get infos in the process of update
/sys/log_create Start to get syslog messages
ADAM-3600 Series
/sys/log_message Get syslog messages
/sys/control Calibration, restart
/value Tag value acquisition
/data/tags /quality Tag quality acquisition
/timestamp Tag timestamp acquisition
/value
/data /gprs_info /quality
/timestamp
/data /di_value /slot_x Data values of digital input channels
/ch_x
Note: All method (GET/ PUT/POST/PATCH) must be used with cookie, seen in 2.10.1 Log in chapter.
2.2 Device Information
/data/device_info/slot_index
Description Retrieves the device information including the I/O module slots.
URL Structure https://10.0.0.1/data/device_info
https://10.0.0.1/ data/device_info /slot_index
where index = 0 : the on board module
1 ~ : the identifier of I/O extension slot
HTTP Method GET:Returns the representation of all of I/O module slots information resource.
PATCH: Set date/time/timezone.
GET Multi Slot Request:
GET / data/device_info
Single Slot Request:
GET / data/device_info /slot_index
[Example]:
Request : GET / data/device_info
Content-type: application/json
Response: 200 OK
{
"slot_0": {
"SL": 0,
"Id": "ADAM-3600-C2GL1A1E",
"DIn": 8,
"DOn": 4,
"AIn": 8,
"AOn": 0,
"FwVer": "01010168",
"Tm": "2016-04-07T03:34:36+08:00",
"Tz": "/Asia/Shanghai"
},
"slot_1": {
"SL": 1,
"Id": "ADAM-3617",
"DIn": 0,
"DOn": 0,
"AIn": 4,
"AOn": 0,
"FwVer": "01010170"
},
"slot_2": {
"SL": 2,
"Id": "ADAM-3618",
"DIn": 0,
"DOn": 0,
"AIn": 4,
"AOn": 0,
"FwVer": "01010173"
},
"slot_4": {
"SL": 4,
"Id": "ADAM-3624",
"DIn": 0,
"DOn": 0,
"AIn": 0,
"AOn": 4,
"FwVer": "01010176"
}
}
Content-type: application/json
Response: 200 OK
{
"SL": 0,
"Id": "ADAM-3600-C2GL1A1E",
"DIn": 8,
"DOn": 4,
"AIn": 8,
"AOn": 0,
"FwVer": "01010168",
"Tm": "2016-04-07T03:38:29+08:00",
"Tz": "/Asia/Shanghai"
}
PUT None
POST None
PATCH Request:PATCH /data/device_info/slot_0
[Example]:
Request: PATCH /data/device_info/slot_0, configure time/date/time zone.
Content-type: application/json
{
"Tm": "2016-04-07T03:38:29+08:00",
"Tz": "/Asia/Shanghai"
}
Response: 200 OK
For example,
“1994-11-05T08:15:30-05:00” corresponds to November
5, 1994, 8:15:30 am, US Eastern Standard Time.
Time zone Tz String RW Note: Only for slot_0 (on board device)
/Asia/Shanghai.
Remarks
2.3 Device Control
/sys/control
2.3.1 Restart
/sys/control/rst
Description The system can be controlled by command objects.
URL Structure https://10.0.0.1/sys/ control/rst
HTTP Method PATCH:Send the control command to module.
GET None
PUT None
PATCH Request:PATCH /sys/control
[Example]:
Request: PATCH /sys/control, Restart the module.
Content-type: application/json
{
"Rst":"1"
}
Response: 200 OK
Remarks
2.3.2 Calibration
/sys/control/cali
[Example]:
Request: PATCH /sys/control, Restart the module.
Content-type: application/json
{
"Mid":"1"
"Cid":"1"
"Rng":"1"
"Calmd ":"1"
"Iot ":"1"
}
Response: 200 OK
0x801F Ttype_Neg270To400C
Calibration mode Calmd String W Calibration mode
1 SaveCaliValToFlash
1 AoSaveCaliValToFlash
3 WriteFacCaliValToUser
0x5500 ZeroCalibration
0xAA00 SpanCalibration
0x55 AoOutputSpanValue
0xAA AoCalibreateSpanValue
IO type Iot String W Range code
0 AI
1 AO
Remarks
2.4 Analog Input
AI - Data Acquisition
/data/ai_value/slot_index/ch_num
Description Retrieves information about the analog input value resource on specific slot.
URL Structure https://10.0.0.1/data/ai_value/slot_index
https://10.0.0.1/data/ai_value/slot_index/ch_num
where index = 0 : the core module
1 ~ : the identifier of I/O extension slot
where num = 0 ~ : the channel number
HTTP Method GET:Returns the representation of all of analog input value resource.
PUT:None
PATCH:Apply partial modifications to analog input value resource.
GET Multi Channel Request:
GET /ai_value/slot_index
Single Channel Request:
GET /ai_value/slot_index/ch_num
[Example]:
Request : GET /ai_value/slot_0
Content-type: application/json
Response: 200 OK
{
"AIVal": [
{
"Ch":0,
"En":0,
"Rng":1,
"Val":32765,
"Eg":0,
"Evt":0,
"LoA": 0,
"HiA": 0,
"HVal":0,
"HEg":0,
"LVal":0,
"LEg":0,
"SVal":0,
"ClrH": 0,
"ClrL": 0
},
{
"Ch":1,
"En":0,
"Rng":1,
"Val":32765,
"Eg":0,
"Evt":0,
"LoA":0,
"HiA":0,
"HVal":0,
"HEg":0,
"LVal":0,
"LEg":0,
"SVal":0,
"ClrH": 0,
"ClrL": 0
},
{
"Ch":2,
"En":0,
"Rng":1,
"Val":32765,
"Eg":0,
"Evt":0,
"LoA":0,
"HiA":0,
"HVal":0,
"HEg":0,
"LVal":0,
"LEg":0,
"SVal":0,
"ClrH": 0,
"ClrL": 0
},
{
"Ch":3,
"En":0,
"Rng":1,
"Val":32765,
"Eg":0,
"Evt":0,
"LoA":0,
"HiA":0,
"HVal":0,
"HEg":0,
"LVal":0,
"LEg":0,
"SVal":0,
"ClrH": 0,
"ClrL": 0
},
{
"Ch":4,
"En":0,
"Rng":1,
"Val":32765,
"Eg":0,
"Evt":0,
"LoA":0,
"HiA":0,
"HVal":0,
"HEg":0,
"LVal":0,
"LEg":0,
"SVal":0,
"ClrH": 0,
"ClrL": 0
}
]
}
Content-type: application/json
Response: 200 OK
{
"Ch":2,
"En":0,
"Rng":1,
"Val":32765,
"Eg":0,
"Evt":0,
"LoA":0,
"HiA":0,
"HVal":0,
"HEg":0,
"LVal":0,
"LEg":0,
"SVal":0,
"ClrH": 0,
"ClrL": 0
}
PUT Single Channel Request:
PUT /ai_value/slot_index/ch_num
[Example]:
Request: PUT /ai_value/slot_0/ch_3
Content-type: application/json
{
"Rng":1
}
Response: 200 OK
PATCH
JSON array name definition:
Abbreviatio
Field Data Type
n
Array of Analog input configurations AIVal Array
AO - Data Acquisition
/data/ao_value/slot_index/ch_num
Description Retrieves information about the analog input value resource on specific slot.
URL Structure https://10.0.0.1/data/ao_value/slot_index
https://10.0.0.1/data/ao_value/slot_index/ch_num
where index = 0 : the core module
1 ~ : the identifier of I/O extension slot
where num = 0 ~ : the channel number
HTTP Method GET:Returns the representation of all of analog output value resource.
PUT:None
PATCH:Apply partial modifications to analog input value resource.
GET Multi Channel Request:
GET /ao_value/slot_index
Single Channel Request:
GET /ao_value/slot_index/ch_num
[Example]:
Request : GET /ao_value/slot_0
Content-type: application/json
Response: 200 OK
{
"AIVal": [
{
"Ch":0,
"Rng":1,
"Val":148,
},
{
"Ch":1,
"Rng":1,
"Val":0,
},
{
"Ch":2,
"Rng":1,
"Val":0,
},
{
"Ch":3,
"Rng":1,
"Val":0,
}
]
}
Content-type: application/json
Response: 200 OK
{
"Ch":2,
"Rng":328,
"Val":0,
}
PUT Single Channel Request:
PUT /ao_value/slot_index/ch_num
[Example]:
Request: PUT /ao_value/slot_0/ch_3
Content-type: application/json
{
"Rng":1,
}
{
"Val": 65535,
}
Response: 200 OK
PATCH
DI - Data Acquisition
/data/di_value/slot_index/ch_num
Description Retrieves information about the digital input value resource on specific slot.
URL Structure https://10.0.0.1/data/di_value/slot_index
https://10.0.0.1/ data/di_value/slot_index/ch_num
where index = 0 : the core module
1 ~ : the identifier of I/O extension slot
where num = 0 ~ : the channel number
HTTP Method GET:Returns the representation of all of digital input value resource.
PUT:Replace all of digital input value resource
PATCH:Apply partial modifications to digital input value resource.
[Example]:
Request : GET /di_value/slot_0
Content-type: application/json
Response: 200 OK
{
"DIVal": [
{
"Ch":0,
"Md":0,
"Stat":1,
"Val":1,
"Cnting":0,
"ClrCnt":0,
"OvLch": 0
},
{
"Ch":1,
"Md":0,
"Stat":0,
"Val":0,
"Cnting":0,
"ClrCnt":0,
"OvLch": 0
},
{
"Ch":2,
"Md":0,
"Stat":0,
"Val":0,
"Cnting":1,
"ClrCnt":0,
"OvLch": 0
},
{
"Ch":3,
"Md":0,
"Stat":0,
"Val":1,
"Cnting":0,
"ClrCnt":0,
"OvLch": 0
}
]
}
Content-type: application/json
Response: 200 OK
{
"Ch":2,
"Md":0,
"Stat":1,
"Val":1,
"Cnting":0,
"ClrCnt":0,
"OvLch": 0
}
[Example]:
Request: PUT /di_value/slot_0/ch_2
Content-type: application/json
{
"Md":1,
}
Response: 200 OK
{
"Cnting":1,
}
Response: 200 OK
PATCH
DO - Data Acquisition
/data/do_value/slot_index/ch_num
Description Retrieves information about the digital input value resource on specific slot.
URL Structure https://10.0.0.1/data/do_value/slot_index
https://10.0.0.1/data/do_value/slot_index/ch_num
where index = 0 : the core module
1 ~ : the identifier of I/O extension slot
where num = 0 ~ : the channel number
HTTP Method GET:Returns the representation of all of digital output value resource.
PUT:Replace all of digital output value resource
PATCH:Apply partial modifications to digital output value resource.
GET Multi Channel Request:
GET /do_value/slot_index
Single Channel Request:
GET /do_value/slot_index/ch_num
[Example]:
Request : GET /do_value/slot_0
Content-type: application/json
Response: 200 OK
{
"DOVal": [
{
"Ch":0,
"Md":0,
"Stat":1,
"Val":1,
"PsCtn":0,
"PsStop":0,
“PsLo” : 5000,
“PsHi” : 5000,
"PsIV": 0
},
{
"Ch":1,
"Md":0,
"Stat":0,
"Val":0,
"PsCtn":0,
"PsStop":0,
“PsLo” : 5000,
“PsHi” : 5000,
"PsIV": 0
},
{
"Ch":2,
"Md":0,
"Stat":0,
"Val":0,
"PsCtn":0,
"PsStop":0,
“PsLo” : 5000,
“PsHi” : 5000,
"PsIV": 0
},
{
"Ch":3,
"Md":0,
"Stat":0,
"Val":1,
"PsCtn":0,
"PsStop":0,
“PsLo” : 5000,
“PsHi” : 5000,
"PsIV": 0
}
]
}
Content-type: application/json
Response: 200 OK
{
"Ch":2,
"Md":0,
"Stat":1,
"Val":1,
"PsCtn":0,
"PsStop":0,
“PsLo” : 5000,
“PsHi” : 5000,
"PsIV": 0
}
PUT Single Channel Request:
PUT /do_value/slot_index/ch_num
[Example]:
Request: PUT /do_value/slot_0/ch_2
Content-type: application/json
{
"Md":0,
}
Response: 200 OK
{
"Val":0,
}
Response: 200 OK
PATCH
/data/tags/
[Example]:
Request : GET /data/ tags /
Content-type: application/json
Response: 200 OK
{
"#SYS_UPTIME": {
"value": "733",
"quality": "0000H",
"timestamp": "1421395474.600190"
},
"#SYS_CURRENT_TIME": {
"value": "1421395474",
"quality": "0000H",
"timestamp": "1421395474.600212"
},
"#SYS_CPU_FREQ": {
"value": "629145600",
"quality": "0000H",
"timestamp": "1421395474.600214"
},
"#SYS_MEM_SIZE": {
"value": "242.18 MB",
"quality": "0000H",
"timestamp": "1421395474.600668"
},
"#SYS_CPU_USED": {
"value": "39.01%",
"quality": "0000H",
"timestamp": "1421395474.600673"
},
"#SYS_MEM_USED": {
"value": "22.70%",
"quality": "0000H",
"timestamp": "1421395474.601017"
},
"#SYS_TFCARD_CAPACITY": {
"value": "954.00 MB",
"quality": "0000H",
"timestamp": "1421395474.677785"
},
"#SYS_TFCARD_FREE_SPACE": {
"value": "98.13 MB",
"quality": "0000H",
"timestamp": "1421395474.677894"
},
"#SYS_SDCARD_CAPACITY": {
"value": "0 Bytes",
"quality": "0000H",
"timestamp": "1421395474.699519"
},
"#SYS_SDCARD_FREE_SPACE": {
"value": "0 Bytes",
"quality": "0000H",
"timestamp": "1421395474.733687"
},
"#SYS_NODE_ID": {
"value": "15",
"quality": "0000H",
"timestamp": "1421395474.736068"
},
"#SYS_COM_COUNT": {
"value": "0.01",
"quality": "0000H",
"timestamp": "1421395474.736074"
},
"#SYS_LAN_COUNT": {
"value": "0",
"quality": "0000H",
"timestamp": "1421395474.736076"
},
"#ICDM_COM1_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_COM2_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_COM3_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN1_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN1_LINK": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN2_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN2_LINK": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
}
PUT None
/data/tags/tag_name/value
/data/tags/tag_name/quality
/data/tags/tag_name/timestamp
[Example]:
Request : GET /data/ tags /
Content-type: application/json
Response: 200 OK
{
"#SYS_UPTIME": {
"value": "733",
"quality": "0000H",
"timestamp": "1421395474.600190"
},
"#SYS_CURRENT_TIME": {
"value": "1421395474",
"quality": "0000H",
"timestamp": "1421395474.600212"
},
"#SYS_CPU_FREQ": {
"value": "629145600",
"quality": "0000H",
"timestamp": "1421395474.600214"
},
"#SYS_MEM_SIZE": {
"value": "242.18 MB",
"quality": "0000H",
"timestamp": "1421395474.600668"
},
"#SYS_CPU_USED": {
"value": "39.01%",
"quality": "0000H",
"timestamp": "1421395474.600673"
},
"#SYS_MEM_USED": {
"value": "22.70%",
"quality": "0000H",
"timestamp": "1421395474.601017"
},
"#SYS_TFCARD_CAPACITY": {
"value": "954.00 MB",
"quality": "0000H",
"timestamp": "1421395474.677785"
},
"#SYS_TFCARD_FREE_SPACE": {
"value": "98.13 MB",
"quality": "0000H",
"timestamp": "1421395474.677894"
},
"#SYS_SDCARD_CAPACITY": {
"value": "0 Bytes",
"quality": "0000H",
"timestamp": "1421395474.699519"
},
"#SYS_SDCARD_FREE_SPACE": {
"value": "0 Bytes",
"quality": "0000H",
"timestamp": "1421395474.733687"
},
"#SYS_NODE_ID": {
"value": "15",
"quality": "0000H",
"timestamp": "1421395474.736068"
},
"#SYS_COM_COUNT": {
"value": "0.01",
"quality": "0000H",
"timestamp": "1421395474.736074"
},
"#SYS_LAN_COUNT": {
"value": "0",
"quality": "0000H",
"timestamp": "1421395474.736076"
},
"#ICDM_COM1_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_COM2_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_COM3_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN1_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN1_LINK": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN2_SCORE": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"#ICDM_LAN2_LINK": {
"value": "0",
"quality": "ffffH",
"timestamp": "0.000000"
},
"ai0": {
"value": "0.00",
"quality": "0000H",
"timestamp": "1425970361.870002"
},
"ai1": {
"value": "0.00",
"quality": "0000H",
"timestamp": "1425970361.870002"
},
"ai2": {
"value": "0.00",
"quality": "0000H",
"timestamp": "1425970361.870002"
},
"ai3": {
"value": "0.00",
"quality": "0000H",
"timestamp": "1425970361.870002"
},
}
Request : GET /data/ tags /ai0 /
Content-type: application/json
Response: 200 OK
{
"value": "0.00",
"quality": "0000H",
"timestamp": "1425970541.870002"
}
Response: 200 OK
Remarks
2.9 Data Logger
/data/datalogger/tagname
Description Retrieves all tag names recorded in data logger..
URL Structure https://10.0.0.1/data/datalogger/tagname
[Example]:
Request : GET / data/ datalogger/tagname
Content-type: application/json
Response: 200 OK
{
"datalogger_tagname": [
"#SYS_CPU_USED",
"#SYS_TFCARD_CAPACITY",
"#SYS_NODE_ID",
"#SYS_LAN_COUNT",
"#SYS_UPTIME",
"#SYS_MAC_LAN1",
"#SYS_MAC_LAN2",
"#MOBILE_MPN",
"#GPS_LATITUDE",
]
}
PUT None
POST None
PATCH None
Remarks
/data/datalogger?Tn=xxxx&St=m&Et=n&Tp=t
Content-type: application/json
Response: 200 OK
{
"records": [
{
"timestamp": "1523424600",
"quality": "-32640",
"partial": "1",
"last": "0.0000",
"min": "0.0000",
"max": "0.0000",
"avg": "0.0000"
},
{
"timestamp": "1523424720",
"quality": "-32640",
"partial": "1",
"last": "0.0000",
"min": "0.0000",
"max": "0.0000",
"avg": "0.0000"
},
{
"timestamp": "1523424900",
"quality": "-32640",
"partial": "1",
"last": "0.0000",
"min": "0.0000",
"max": "0.0000",
"avg": "0.0000"
},
{
"timestamp": "1523424960",
"quality": "-32640",
"partial": "0",
"last": "0.0000",
"min": "0.0000",
"max": "0.0000",
"avg": "0.0000"
},
{
"timestamp": "1523425020",
"quality": "-32640",
"partial": "0",
"last": "0.0000",
"min": "0.0000",
"max": "0.0000",
"avg": "0.0000"
}
],
"count": "5"
}
[Example]: Query Historical data
Request : GET
/ data/ datalogger?Tn=%23SYS_CPU_USED&St=1523424600&Et=1523424659&Tp=-1
{
"records": [
{
"timestamp": "1523424652.0000",
"value": "0.0000",
"quality": "-32640"
},
{
"timestamp": "1523424653.0000",
"value": "0.0000",
"quality": "-32640"
},
{
"timestamp": "1523424654.0000",
"value": "0.0000",
"quality": "-32640"
},
{
"timestamp": "1523424655.0000",
"value": "0.0000",
"quality": "-32640"
},
{
"timestamp": "1523424656.0000",
"value": "0.0000",
"quality": "-32640"
},
{
"timestamp": "1523424657.0000",
"value": "0.0000",
"quality": "-32640"
},
{
"timestamp": "1523424658.0000",
"value": "0.0000",
"quality": "-32640"
},
{
"timestamp": "1523424659.0000",
"value": "0.0000",
"quality": "-32640"
}
],
"count": "8"
}
PUT None
POST None
PATCH None
2.10.1 Log in
/sys/log_in
Response:
{
"sesion_id": "c9f4baf91d3e4ed7cfb18e598c5711f5",
}
Cookie: ADAMID=c9f4baf91d3e4ed7cfb18e598c5711f5
/sys/log_out
Response:
{
"Success":"Log out "
}
Resource value definitions :
Remarks
2.11 Image Update
/sys/upload
The standard way to upload files in a web application is to use a form with a special
multipart/form-data encoding.
<RFC1521> In the case of multiple part entities, in which one or more different sets
of data are combined in a single body, a "multipart" Content-Type field must appear in
the entity's header. The body must then contain one or more "body parts," each
preceded by an encapsulation boundary, and the last one followed by a closing
boundary. Each part starts with an encapsulation boundary, and then contains a body
part consisting of header area, a blank line, and a body area.
Each body part is preceded by an encapsulation boundary. The encapsulation
boundary MUST NOT appear inside any of the encapsulated parts. Thus, it is
crucial that the composing agent be able to choose and specify the unique boundary
that will separate the parts.
Encapsulation boundaries must not appear within the encapsulations, and must be no
longer than 70 characters, not counting the two leading hyphens.
The encapsulation boundary following the last body part is a distinguished delimiter
that indicates that no further body parts will follow. Such a delimiter is identical to
the previous delimiters, with the addition of two more hyphens at the end of the line:
--gc0p4Jq0M2Yt08jU534c0p--
<RFC2388> “Multipart/form-data” can be used for forms that are presented using
representations other than HTML (spreadsheets, Portable Document Format, etc), and
for transport using other means than electronic mail or HTTP. This document
defines the representation of form values independently of the application for which it
is used.
"Multipart/form-data" contains a series of parts. Each part is expected to contain a
content-disposition header [RFC 2183] where the disposition type is "form-data", and
where the disposition contains an (additional) parameter of "name", where the value
of that parameter is the original field name in the form. For example, a part might
contain a header:
Content-Type:multipart/form-data;
boundary=----WebKitFormBoundaryuTETT0zNHgTxZV1W
------WebKitFormBoundaryuTETT0zNHgTxZV1W
Content-Disposition:form-data;
name="ADAM-3600-image-1.1.2.bin";
filename="ADAM-3600-image-1.1.2.bin"
Content-Type: text/plain
< data>
------WebKitFormBoundaryuTETT0zNHgTxZV1W--
Response: 200 OK
/sys/update
Response:
{
"Notice":"updating"
}
Resource value definitions :
Remarks Must log in first
/sys/update_info
Response:
{
"updateinfo": "xxxxxxxx…"
}
/sys/version?filename=/tmp/menifest.xml
Description Show the version information of the update package for ADAM-3600.
URL Structure https://10.0.0.1/sys/ version?filename=/tmp/menifest.xml
HTTP Method GET
GET Request:GET /sys/version?filename=/tmp/menifest.xml
[Example]:
Request:
GET /sys/version?filename=/tmp/menifest.xml
Content-type: application/json
PUT None
POST None
Resource value definitions :
Remarks
2.12 System log file
/sys/log_create
Response:
{
"TS":"1431773198"
}
PUT None
POST None
Resource value definitions :
Field Abbreviation Data Type Property Description
TimeStamp TS String R The timestamp to create the get syslog
message thread
Remarks
/sys/log_message
[Example]:
Request: POST /sys/log_message
Content-type: application/json
Request:
{
"TS":"1431773198"
}
Response:
{
" syslog_info ":"xxxxxxxx..."
}
/data/gprs_info
[Example]:
Request : GET /data/ gprs_info
Content-type: application/json
Response: 200 OK
{
"MOBILE_MNO": "No GPRS Service",
"MOBILE_MNT": "No GPRS Service",
"MOBILE_MPN": "0",
"MOBILE_MDT": "0 Bytes",
"MOBILE_SIGNAL_QUALITY": "Not Connected(0)",
"PUB_IP": "0.0.0.0"
}
Request : GET /data/ gprs_info/ PUB_IP
Content-type: application/json
Response: 200 OK
{
"0.0.0.0"
}
PUT None
Resource value definitions :
Field Abbreviation Data Type Property Description
Mobile network operator MOBILE_MNO String R Mobile operator:
China Mobile
China Unicom
China Telecom
China Tietong
Mobile network type MOBILE_MNT String R Mobile network type:
2G, 3G, 4G
Mobile Phone Number MOBILE_MPN String R Mobile Phone Number
86xxxxxxxxxxx
Mobile data traffic MOBILE_MDT String R Mobile data traffic
Mobile signal quality MOBILE_SIGN String R Mobile signal quality
AL_QUALITY 0-100