Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
en:mervis-scada:50-api [2019/07/10 11:36]
m.chlupac
en:mervis-scada:50-api [2020/04/06 13:14]
m.chlupac [api/set/history]
Line 3: Line 3:
 Mervis SCADA offers open REST-like API based on JSON and XML data formats. For full description please contact our [[:en:help:support|technical support]]. Mervis SCADA offers open REST-like API based on JSON and XML data formats. For full description please contact our [[:en:help:support|technical support]].
  
 +**Important:** Only officially supported response format is XML!
 ===== List of basic API methods ===== ===== List of basic API methods =====
  
Line 52: Line 53:
 <checkCredentialsResult xmlns:r="http://dev.rcware.eu/serialization/references" d="GlobalDomain" l="demo" t="2:85be00d3-5875-4dec-a9b4-c98e2ff2acbe" xmlns="http://dev.rcware.eu/auth" /> <checkCredentialsResult xmlns:r="http://dev.rcware.eu/serialization/references" d="GlobalDomain" l="demo" t="2:85be00d3-5875-4dec-a9b4-c98e2ff2acbe" xmlns="http://dev.rcware.eu/auth" />
 </code> </code>
 +
 +  * You **should** use the received token **t** in subsequent API calls.
  
 ====api/get/history==== ====api/get/history====
Line 135: Line 138:
  
 </code> </code>
 +
 +
 +====api/set/history====
 +
 +**Request**
 +
 +   * URL: /api/set/history?format=xml
 +   * Method: POST
 +
 +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.
 +
 +Even though there could be used name and password in **cred** - you should always use **token** to get the best performance.
 +
 +All date and time values are supposed to be in UTC.
 +
 +<code xml>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<setHistoryRequest xmlns="http://dev.rcware.eu/scada/history" 
 +xmlns:n2="http://dev.rcware.eu/auth" 
 +xmlns:n1="http://dev.rcware.eu/scada/basic-props" 
 +projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0" 
 +dpId="e86dba6d-1250-4e7f-aafb-84fd28324710">
 +  <n2:cred t="xxxxx"/><!-- token should be always used here -->
 +  <vals>
 +    <hv ts="2020-03-15T11:00:00+00:00" i="P1D">
 +      <n1:v>2.7</n1:v>
 +    </hv>
 +    <hv ts="2020-03-16T11:00:00+00:00" i="P1D">
 +      <n1:v>3.0</n1:v>
 +    </hv>
 +    <hv ts="2020-03-17T11:00:00+00:00" i="P1D">
 +      <n1:v>2.0</n1:v>
 +    </hv>
 +    <hv ts="2020-03-18T11:00:00+00:00" i="P1D">
 +      <n1:v>2.3</n1:v>
 +    </hv>
 +  </vals>
 +</setHistoryRequest></code>
 +
 +**Response**
 +
 +   * 200 OK
 +
 +====api/set/executeActions====
 +
 +**Request**
 +
 +   * URL: /api/set/executeActions?format=xml
 +   * Method: POST
 +
 +<code xml>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<executeActionsRequest xmlns="http://dev.rcware.eu/scada/action-defs" 
 +xmlns:n2="http://dev.rcware.eu/scada/basic-props" 
 +xmlns:n1="http://dev.rcware.eu/auth" 
 +xmlns:r="http://dev.rcware.eu/serialization/references">
 +  <n1:cred n="userName" p="password"/>
 +  <actionDefs projId="5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0">
 +    <actions>
 +      <actionDefItem propName="INIT" dpId="afc22e18-f8e4-4e08-899c-fb9e4759df3d">
 +        <execParam r:type="495c9644-eed1-4b94-933b-3fae702a9aca">
 +          <n2:value>16</n2:value>
 +        </execParam>
 +      </actionDefItem>
 +      <actionDefItem propName="ZAP" dpId="34306c80-73f1-4465-ab51-2b2c1e85ab70">
 +      </actionDefItem>
 +    </actions>
 +  </actionDefs>
 +</executeActionsRequest></code>
 +
 +**Response**
 +
 +<code xml><?xml version="1.0" encoding="utf-8"?>
 +<executeActionsResponse xmlns:r="http://dev.rcware.eu/serialization/references" code="Ok" message="OK" xmlns="http://dev.rcware.eu/scada/error-reporting" /></code>
 +
  
 ===== Matlab Client ===== ===== Matlab Client =====
  • © Energocentrum Plus, s.r.o. 2017 - 2024