Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
en:mervis-scada:50-api [2020/04/06 13:14] m.chlupac [api/set/history] |
en:mervis-scada:50-api [2020/10/05 09:25] m.chlupac [api/get/values] |
| |
| |
===== Example ===== | ===== Examples ===== |
| |
====api/checkCredentials==== | ====api/checkCredentials==== |
* URL: /api/set/history?format=xml | * URL: /api/set/history?format=xml |
* Method: POST | * Method: POST |
| * Content-Type: text/xml |
| |
Attribute **i** sets **interval** ([[https://en.wikipedia.org/wiki/ISO_8601#Time_intervals|ISO 8601]]) in which the next value should be expected to be saved into database. | Attribute **i** sets **interval** ([[https://en.wikipedia.org/wiki/ISO_8601#Time_intervals|ISO 8601]]) in which the next value should be expected to be saved into a database. |
| |
Even though there could be used name and password in **cred** - you should always use **token** to get the best performance. | Even though there could be used name and password in **cred** - you should always use **token** to get the best performance. |
projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0" | projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0" |
dpId="e86dba6d-1250-4e7f-aafb-84fd28324710"> | dpId="e86dba6d-1250-4e7f-aafb-84fd28324710"> |
<n2:cred t="xxxxx"/><!-- token should be always used here --> | <n2:cred t="xxxxx"/><!-- token should be used here --> |
<vals> | <vals> |
<hv ts="2020-03-15T11:00:00+00:00" i="P1D"> | <hv ts="2020-03-15T11:00:00+00:00" i="P1D"> |
* URL: /api/set/executeActions?format=xml | * URL: /api/set/executeActions?format=xml |
* Method: POST | * Method: POST |
| * Content-Type: text/xml |
| |
<code xml> | <code xml> |
xmlns:n1="http://dev.rcware.eu/auth" | xmlns:n1="http://dev.rcware.eu/auth" |
xmlns:r="http://dev.rcware.eu/serialization/references"> | xmlns:r="http://dev.rcware.eu/serialization/references"> |
<n1:cred n="userName" p="password"/> | <n1:cred t="xxxxxx"/> |
<actionDefs projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0"> | <actionDefs projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0"> |
<actions> | <actions> |
<executeActionsResponse xmlns:r="http://dev.rcware.eu/serialization/references" code="Ok" message="OK" xmlns="http://dev.rcware.eu/scada/error-reporting" /></code> | <executeActionsResponse xmlns:r="http://dev.rcware.eu/serialization/references" code="Ok" message="OK" xmlns="http://dev.rcware.eu/scada/error-reporting" /></code> |
| |
| ====api/get/values==== |
| |
| The right way how to retrieve current values of data points (property "Output" which is usually what you want) from one or multiple projects. |
| |
| **Request** |
| |
| * URL: /api/get/values?format=xml |
| * Method: POST |
| |
| <code javascript> |
| { |
| "cred": { |
| "t": "xxxxxx" //token |
| }, |
| "propNamesToSerialize": ["Output"], |
| "offset": 0, |
| "count": 1000, |
| "serverState": null, |
| "dps": [{ |
| "projId": "ba1a92f7-f213-4a72-90e4-f7142b50274b", |
| "dpIds": ["e089dde2-a097-4e0d-8012-c8cf3dc62694", "1089dde2-a097-4e0d-8012-c8cf3dc62696"] |
| } |
| ] |
| } |
| |
| </code> |
| |
| **Response** |
| |
| <code xml><?xml version="1.0" encoding="utf-8"?> |
| <values xmlns:r="http://dev.rcware.eu/serialization/references" nextOffset="-1" serverTime="2020-04-07T07:46:34.850422Z" xmlns:n1="http://dev.rcware.eu/scada/basic-props" xmlns="http://dev.rcware.eu/scada/datapoints"> |
| <vals> |
| <v projId="ba1a92f7-f213-4a72-90e4-f7142b50274b" dataVersion="637217783110000000" serverTime="2020-04-07T07:46:34.850422Z"> |
| <dps> |
| <d id="e089dde2-a097-4e0d-8012-c8cf3dc62694" serAlr="true"> |
| <props> |
| <p n="Output" t="2020-04-07T07:43:42.1000676Z" q="Bad" r:type="177e726a-3180-4152-bef2-6254e7055e1f"> |
| <n1:v>ON</n1:v> |
| </p> |
| </props> |
| </d> |
| <d id="1089dde2-a097-4e0d-8012-c8cf3dc62696" serAlr="true"> |
| <props> |
| <p n="Output" t="2020-04-07T07:45:00.2408399Z" q="Good" r:type="b133774d-21ce-42b6-add3-57c012079c55"> |
| <n1:v>0</n1:v> |
| </p> |
| </props> |
| </d> |
| </dps> |
| </v> |
| </vals> |
| </values></code> |
| |
| ====api/get/projectByParts==== |
| |
| To get the list of datapoints. |
| |
| **Request** |
| |
| * URL: /api/get/projectByParts?format=xml |
| * Method: POST |
| |
| <code javascript> |
| { |
| "cred": { |
| "t": "xxxxxx" |
| }, |
| "projId": "5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0", |
| "treeId": "Visual tree", |
| "partType": 0, |
| "offset": 0, |
| "count": 250 |
| } |
| </code> |
| |
| **Response** |
| |
| <code xml><?xml version="1.0" encoding="utf-8"?> |
| <getProjectByPartsResult xmlns:r="http://dev.rcware.eu/serialization/references" projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0" dataVersion="637305748282414171" totalCount="79" nextOffset="-1" xmlns:n1="http://dev.rcware.eu/scada/comm-props" xmlns:n2="http://dev.rcware.eu/rt2com" xmlns:n3="http://dev.rcware.eu/scada/basic-props" xmlns:n4="http://dev.rcware.eu/scada/legacy-props" xmlns="http://dev.rcware.eu/scada/datapoints"> |
| <dps> |
| <dp id="393df7b4-bb8d-4e8f-92a7-bf785508894a" n="Provozni podminky OK" canAct="true" canAlr="true"> |
| <v> |
| <props> |
| <p n="Source" t="2020-10-05T07:17:11.601879Z" q="Good" n1:dateTimeKind="UTC" r:type="1c104bdf-ffcb-4c90-b491-e4781a91ef09"> |
| <n1:r n2:rp="PT0S" r:type="7b047602-40da-4095-9093-062ba30fd15e"> |
| <n2:a id="3b1e3b8b-2186-4dcf-b157-8032c768d1e1" n="SW.Provozni podminky OK"/> |
| </n1:r> |
| <n1:w r:type="5ddc9dbf-a6bd-458b-a6ab-f661db0e3a64"> |
| <n2:a id="3b1e3b8b-2186-4dcf-b157-8032c768d1e1" n="SW.Provozni podminky OK"/> |
| </n1:w> |
| <n1:v>1</n1:v> |
| </p> |
| <p n="Output" t="2020-10-05T07:16:58.751431Z" q="Good" r:type="177e726a-3180-4152-bef2-6254e7055e1f"> |
| <n3:v>OK</n3:v> |
| </p> |
| <p n="StdVis_V1" t="2015-06-03T13:17:13.5190205Z" q="Good" r:type="b0db7bd7-0375-4830-90f2-6d918bac41ee"> |
| <n3:v> |
| <n3:props> |
| <n3:p> |
| <n3:pn>Output</n3:pn> |
| <n3:props> |
| <n3:p r:type="256a44f6-32e4-4a75-b7c2-08eed38f151d"> |
| <n3:ordMap> |
| <n3:grOrd> |
| <n3:t>OK</n3:t> |
| <n3:o>0</n3:o> |
| </n3:grOrd> |
| <n3:grOrd> |
| <n3:t>ALARM</n3:t> |
| <n3:o>1</n3:o> |
| </n3:grOrd> |
| </n3:ordMap> |
| </n3:p> |
| </n3:props> |
| </n3:p> |
| </n3:props> |
| </n3:v> |
| </p> |
| </props> |
| </v> |
| <core r:type="2f04d90c-ee95-4cb6-b945-146e33021945"/> |
| </dp> |
| <dp id="3e5c0b88-45fd-4e3f-b1b2-1a365327ec90" n="Zaplavení" canAct="true" canAlr="true"> |
| <v> |
| <props> |
| <p n="Source" t="2020-08-17T10:21:46.470472Z" q="Good" n1:dateTimeKind="UTC" r:type="1c104bdf-ffcb-4c90-b491-e4781a91ef09"> |
| <n1:r n2:rp="PT0S" r:type="7b047602-40da-4095-9093-062ba30fd15e"> |
| <n2:a id="45c31fe4-00b0-4498-b9f6-adfe6a2fe34b" n="SW.Zaplavení mem"/> |
| </n1:r> |
| <n1:w r:type="5ddc9dbf-a6bd-458b-a6ab-f661db0e3a64"> |
| <n2:a id="45c31fe4-00b0-4498-b9f6-adfe6a2fe34b" n="SW.Zaplavení mem"/> |
| </n1:w> |
| <n1:v>0</n1:v> |
| </p> |
| <p n="Output" t="2020-08-17T10:21:46.470472Z" q="Good" r:type="177e726a-3180-4152-bef2-6254e7055e1f"> |
| <n3:v>OK</n3:v> |
| </p> |
| <p n="StdVis_V1" t="2015-06-03T13:17:13.5190205Z" q="Good" r:type="b0db7bd7-0375-4830-90f2-6d918bac41ee"> |
| <n3:v> |
| <n3:props> |
| <n3:p> |
| <n3:pn>Output</n3:pn> |
| <n3:props> |
| <n3:p r:type="256a44f6-32e4-4a75-b7c2-08eed38f151d"> |
| <n3:ordMap> |
| <n3:grOrd> |
| <n3:t>OK</n3:t> |
| <n3:o>0</n3:o> |
| </n3:grOrd> |
| <n3:grOrd> |
| <n3:t>ALARM</n3:t> |
| <n3:o>1</n3:o> |
| </n3:grOrd> |
| </n3:ordMap> |
| </n3:p> |
| </n3:props> |
| </n3:p> |
| </n3:props> |
| </n3:v> |
| </p> |
| </props> |
| </v> |
| <core r:type="2f04d90c-ee95-4cb6-b945-146e33021945"/> |
| <alr> |
| <def enabled="true" delay="PT1M"/> |
| <galrs/> |
| <status user="SYSTEM" incidentId="88ba7198-de57-4854-8130-60c240a09522" lastChangeTime="2020-08-11T12:37:04.8002341Z"/> |
| </alr> |
| </dp> |
| </dps> |
| </getProjectByPartsResult></code> |
===== Matlab Client ===== | ===== Matlab Client ===== |
==== General notes client function parameters ==== | ==== General notes client function parameters ==== |