Check Working Status
Usage
{MWA URL}/machiot-rest-api/ --> Latest version api {MWA URL}/machiot-rest-api/v1/ --> Version 1
Example
http://192.168.0.31:5003/machiot-rest-api/ http://192.168.0.31:5003/machiot-rest-api/v1/
Result
{ "status": "Working", "version": "1.0" }
curl Example
curl -G 'http://192.168.0.31:5003/machiot-rest-api/'
get Calculated Data
Usage
{MWA URL}/machiot-rest-api/datapoints/calculated/{TagName}/{Start}/{End}/{CalculationMode}/{Count}/{IntervalType}/{IntervalValue}/ TagName : Tag Name. Supports multiple tags (separated by ,) -> Passes multiple Tag results to a single Series Start, End : Period, YYYY-MM-DD HH24:MI:SS or YYYY-MM-DD CalculationMode : min, max, total(sum), count(cnt), average(avg) Count : LIMIT, all if 0 IntervalType : sec(second), min(minute), hour, day IntervalValue : Unit of IntervalType (5 sec, 3 min, etc.) Default 1
Can also be passed to Get method parameter (duplicate URL takes precedence)
If TagName is separated by, and multiple tags are specified, it is returned as one Series.
Use this when you want to combine several tags that have data only in a certain time zone and get results in one series.
If the data is duplicated, the data of the quick tag is selected in the order by order of TagName.
Example
http://192.168.0.31:5003/machiot-rest-api/v1/datapoints/calculated/TAG_193,TAG_194/2018-01-16T14:40:00/2018-01-16T14:50:00/cnt/0/sec http://192.168.0.31:5003/machiot-rest-api/v1/datapoints/calculated?TagNames=TAG_193,TAG_194&Start=2018-01-16T14:40:00&End=2018-01-16T14:50:00&CalculationMode=cnt&count=0&IntervalType=sec
Result
{ "ErrorCode": 0, "ErrorMessage": "", "Data": [ {"DataType": "LONG", "ErrorCode": 0, "TagName": "TAG_193,TAG_194", "CalculationMode": "cnt", "Samples": [ {"TimeStamp": "2018-01-16 14:40:05 000:000:000", "Value": 6, "Quality": 0}, {"TimeStamp": "2018-01-16 14:40:06 000:000:000", "Value": 25, "Quality": 0}, .... ] } ] }
curl Example
curl -G 'http://192.168.0.31:5003/machiot-rest-api/datapoints/calculated/TAG_193,TAG_194/2018-01-16T14:40:00/2018-01-16T14:50:00/cnt/0/sec'
get Raw Data
Usage
{MWA URL}/machiot-rest-api/datapoints/raw/{TagName}/{Start}/{End}/{Direction}/{Count}/{Offset}/ TagName : Tag Name. Supports multiple tags (separated by ,) -> Passes multiple Tag results to a single Series Start, End : Period, YYYY-MM-DD HH24:MI:SS or YYYY-MM-DD or YYYY-MM-DD HH24:MI:SS,mmm (mmm: millisecond, if omitted, start is 000, End is 999) Direction : 0(not use= default value), 1(descend), 2(ascend) Count : LIMIT, all if 0 Offset : offset (default value = 0)
Can also be passed to Get method parameter (duplicate URL takes precedence)
If TagName is separated by, and multiple tags are specified, it is returned as one Series.
Use this when you want to combine several tags that have data only in a certain time zone and get results in one series.
If the data is duplicated, the data of the quick tag is selected in the order by order of TagName.
Example
http://192.168.0.31:5003/machiot-rest-api/v1/datapoints/raw/TAG_193,TAG_194/2018-01-16T14:40:00,500/2018-01-16T14:40:10,800 http://192.168.0.31:5003/machiot-rest-api/v1/datapoints/raw?TagNames=TAG_193,TAG_194&Start=2018-01-16T14:40:00,500&End=2018-01-16T14:40:10,800
Result
{ "ErrorCode": 0, "ErrorMessage": "", "Data": [ {"DataType": "DOUBLE", "ErrorCode": 0, "TagName": "TAG_193,TAG_194", "Samples": [ {"TimeStamp": "2018-01-16 14:40:05 538:012:000", "Value": 100.0, "Quality": 0}, {"TimeStamp": "2018-01-16 14:40:05 798:813:000", "Value": 26.0, "Quality": 0}, .... ] } ] }
curl Example
curl -G 'http://192.168.0.31:5003/machiot-rest-api/datapoints/raw/TAG_193,TAG_194/2018-01-16T14:40:00,500/2018-01-16T14:40:10,800'
INSERT
When called with the POST method, it is appended to the TAG table.
parameter is the same, except that the name (= Table Name) is not present in the POST method parameter of the RESTful API.
Parameter
{ "values":[ [TAG_NAME, TAG_TIME, VALUE], [ .... ].... ], "date_format":"Date Format" } Note: If date_format is omitted, set to 'YYYY-MM-DD HH24: MI: SS mmm: uuu: nnn'
Example: GET URL
http://192.168.0.31:5003/machiot-rest-api/
Example: POST data
{ "values":[ ["TAG_0","2018-01-11 01:16:37",100], ["TAG_1","2018-01-11 01:16:37",100], ["TAG_2","2018-01-11 01:16:37",100], ["TAG_3","2018-01-11 01:16:37",100], ["TAG_4","2018-01-11 01:16:37",100], ["TAG_5","2018-01-11 01:16:37",100], ["TAG_6","2018-01-11 01:16:37",100], ["TAG_7","2018-01-11 01:16:37",100], ["TAG_8","2018-01-11 01:16:37",100], ["TAG_9","2018-01-11 01:16:37",100] ], "date_format":"YYYY-MM-DD HH24:MI:SS" }
curl Example
curl -X POST -H "Content-Type: application/json" "http://127.0.0.1:5003/machiot-rest-api/" -d '{ "values":[["TAG_00","2018-01-11 01:16:37",100],["TAG_01","2018-01-11 01:16:37",100]], "date_format":"YYYY-MM-DD HH24:MI:SS" }'
Get Tag List
Obtain a list of tags.
Usage
{MWA URL}/machiot-rest-api/tags/list/
Example
http://192.168.0.31:5003/machiot-rest-api/tags/list/
Result
{ "ErrorCode": 0, "ErrorMessage": "", "Data": [ {"NAME": "TAG_00"}, {"NAME": "TAG_01"}, {"NAME": "TAG_02"}, {"NAME": "TAG_03"}, ...... ] }
curl Example
curl -G 'http://192.168.0.31:5003/machiot-rest-api/tags/list'
Get Time Range
Obtain the time range of the input data.
Usage
{MWA URL}/machiot-rest-api/tags/range/ {MWA URL}/machiot-rest-api/tags/range/{TagName} TagName : Tag Name (Currently, multiple Tag Names are not supported) If there is no TagName, obtains the time range for all data.
Example
http://192.168.0.31:5003/machiot-rest-api/tags/range/TAG_00
Result
{ "ErrorCode": 0, "ErrorMessage": "", "Data": [ {"MIN": "2017-01-01 00:00:00 000:000:000", "MAX": "2017-02-02 19:02:13 000:000:000"} ] }
curl Example
curl -G 'http://192.168.0.31:5003/machiot-rest-api/tags/range/TAG_00'
Request Rollup
Force rollup. (Execute 'EXEC ROLLUP_FORCE' command, takes about 6 seconds)
Usage
{MWA URL}/machiot-rest-api/rollup/
Example
http://192.168.0.31:5003/machiot-rest-api/rollup/
Result
{ "ErrorCode": 0, "ErrorMessage": "", "Data": [ {"EXECUTE RESULT": "Execute Success"} ] }
curl Example
curl -G 'http://192.168.0.31:5003/machiot-rest-api/rollup/'