Toto je starší verze dokumentu!
API
Mervis SCADA nabízí otevřené REST-like API postavené na JSON a XML formátech dat. Pro kompletní popis API kontaktujte naši technickou podporu.
Přehled základních API metod
| Function | Description |
|---|
| api/checkCredentials | |
|---|---|
| api/logout | |
| api/get/projects | |
| api/get/projectData | |
| api/get/projectByParts | |
| api/get/history | |
| api/get/history/specific | |
| api/set/history | |
| api/get/values | |
| api/get/alarms | |
| api/get/alarmHistory | |
| api/get/eventHistory | |
| api/get/changes | |
| api/set/executeActions | |
| api/set/values | |
| api/set/executeAlarmOps | |
| api/set/projectPriorityRefresh | |
| api/get/schema | |
| api/get/schema/datapoints | |
| api/get/schema/values | |
| api/get/schema/image |
Příklad
api/get/history
Request
- URL: /api/get/history?format=xml
- Method: POST
{
"cred":{
"t":"d1871589-c455-416a-91f3-d9cda3aa5e0f"
},
"projId":"2e4deb05-0517-4ef7-ae7a-02e146b23a1d",
"dpId":"ffb370fc-eeb8-404f-9088-46577ea64134",
"providerId":"689E32FA-24A2-448E-9374-6158E6E6CB15",
"from":"/Date(1494280800000)/", //UTC, Unixtime milliseconds
"to":"/Date(1494412488822)/", //UTC, Unixtime milliseconds
"offset":0,
"count":5000,
"historyState":""
}
Response
<getHistoryResult xmlns:r="http://dev.rcware.eu/serialization/references" r:type="b133774d-21ce-42b6-add3-57c012079c55" xmlns:n1="http://dev.rcware.eu/scada/basic-props" xmlns="http://dev.rcware.eu/scada/history"> <hist projId="2e4deb05-0517-4ef7-ae7a-02e146b23a1d" dpId="ffb370fc-eeb8-404f-9088-46577ea64134" propName="Output" interval="PT5M" historyState="" nextValOfs="-1"> <errMsg/> <vals> <hv ts="2017-05-08T22:26:53.32684Z" gt="2017-05-08T22:31:53.465467Z"> <n1:v>4.3</n1:v> </hv> <hv ts="2017-05-08T22:36:53.283875Z"> <n1:v>4.2</n1:v> </hv> <hv ts="2017-05-08T22:41:53.435042Z"> <n1:v>4.1</n1:v> </hv> <hv ts="2017-05-08T22:46:53.711496Z" gt="2017-05-08T23:36:53.776657Z"> <n1:v>4</n1:v> </hv> </vals> </hist> </getHistoryResult>
api/v2/get/history
Request
- URL: /api/v2/get/history?format=xml
- Method: POST
{
"data":{
"cred":{
"n":"demo", //username
"p":"demo", //password
"pe":0
},
"projId":"5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0",
"from":"/Date(1540388023926)/", //UTC, Unixtime milliseconds
"to":"/Date(1540389034926)/", //UTC, Unixtime milliseconds
"offset":0, //offset-count pair for multiple variables
"variableOffset":0,
"count":5000,
"historyState":"",
"providersDps":[
{
"m_Item1":"689e32fa-24a2-448e-9374-6158e6e6cb15", //DB Provider ID - don't change it
"m_Item2":"62cf4083-31ed-4bc1-be25-044ba837a9f0" //Datapoint ID - different for each datapoint
},
{
"m_Item1":"689e32fa-24a2-448e-9374-6158e6e6cb15", //DB Provider ID - don't change it
"m_Item2":"2ec7ddcb-17b5-4a6e-81da-a4b6e6f6fb11" //Datapoint ID - different for each datapoint
}
]
}
}
Response
<?xml version="1.0" encoding="utf-8"?> <globalResponse xmlns:r="http://dev.rcware.eu/serialization/references" xmlns:n1="http://dev.rcware.eu/scada/getHistoryV2/response" xmlns:n2="http://dev.rcware.eu/scada/datapoints" xmlns:n3="http://dev.rcware.eu/scada/history" xmlns:n4="http://dev.rcware.eu/scada/basic-props" xmlns="http://dev.rcware.eu/core/globalRequestResponse"> <result code="0" codeTxt="Ok" desc="" dataType="" /> <data n1:count="2" n1:nextOffset="-1" n1:nextVariableOffset="-1" n1:nextHistoryState="" r:type="d70d8bcb-04a7-4bca-a626-4f6dd466c6e0"> <n1:providerHistories> <n1:providerHistories providerId="689e32fa-24a2-448e-9374-6158e6e6cb15"> <n1:dpHistories> <n2:pl> <n2:p n="Output" u="hod" r:type="b133774d-21ce-42b6-add3-57c012079c55"> <n3:hist projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0" dpId="2ec7ddcb-17b5-4a6e-81da-a4b6e6f6fb11" propName="Output" interval="PT3M" historyState="" nextValOfs="-1"> <n3:errMsg></n3:errMsg> <n3:vals> <n3:hv ts="2018-10-23T16:27:41.5932104Z" gt="2018-10-25T09:15:42.1992342Z"> <n4:v>11979</n4:v> </n3:hv> </n3:vals> </n3:hist> </n2:p> <n2:p n="Output" u="hod" r:type="b133774d-21ce-42b6-add3-57c012079c55"> <n3:hist projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0" dpId="62cf4083-31ed-4bc1-be25-044ba837a9f0" propName="Output" interval="PT3M" historyState="" nextValOfs="-1"> <n3:errMsg></n3:errMsg> <n3:vals> <n3:hv ts="2018-10-24T12:48:42.1926956Z" gt="2018-10-24T15:06:41.9453803Z"> <n4:v>12702</n4:v> </n3:hv> </n3:vals> </n3:hist> </n2:p> </n2:pl> </n1:dpHistories> </n1:providerHistories> </n1:providerHistories> </data> </globalResponse>