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:38]
m.chlupac
en:mervis-scada:50-api [2020/04/06 13:11]
m.chlupac [api/get/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 53: Line 54:
 </code> </code>
  
-  * You can use the received token **t** in subsequent API calls.+  * You **should** use the received token **t** in subsequent API calls.
  
 ====api/get/history==== ====api/get/history====
Line 137: Line 138:
  
 </code> </code>
 +
 +
 +====api/set/history====
 +
 +**Request**
 +
 +   * URL: /api/set/history?format=xml
 +   * Method: POST
 +
 +Atribut **i** nastavuje **interval** ([[https://en.wikipedia.org/wiki/ISO_8601#Time_intervals|ISO 8601]]), v jakém by měla být uložena následující hodnota.
 +
 +V **cred** lze použít i ověření pomocí jména a hesla, ale využití **tokenu** nabízí vyšší výkon.
 +
 +Všechny časové údaje jsou očekávány v 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