Differences
This shows you the differences between two versions of the page.
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 [2023/09/26 14:19] v.kohout [List of basic API methods] |
||
---|---|---|---|
Line 3: | Line 3: | ||
Mervis SCADA offers open REST-like API based on JSON and XML data formats. For full description please contact our [[: | Mervis SCADA offers open REST-like API based on JSON and XML data formats. For full description please contact our [[: | ||
+ | **Important: | ||
===== List of basic API methods ===== | ===== List of basic API methods ===== | ||
Line 14: | Line 15: | ||
^api/ | ^api/ | ||
^api/ | ^api/ | ||
+ | ^api/ | ||
^api/ | ^api/ | ||
^api/ | ^api/ | ||
Line 31: | Line 33: | ||
- | ===== Example | + | ===== Examples |
====api/ | ====api/ | ||
Line 39: | Line 41: | ||
* URL: / | * URL: / | ||
* Method: POST | * Method: POST | ||
- | |||
- | **Request** | ||
<code javascript> | <code javascript> | ||
Line 53: | Line 53: | ||
</ | </ | ||
- | * You can use the received token **t** in subsequent API calls. | + | * You **should** |
- | ====api/ | + | |
+ | |||
+ | ==== api/ | ||
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | * Downloading of one or multiple trends with single API call | ||
+ | * You should always use " | ||
+ | * " | ||
+ | * " | ||
+ | * Items: " | ||
+ | |||
+ | |||
+ | <code javascript> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **Response** | ||
+ | |||
+ | * Empty " | ||
+ | * " | ||
+ | * Values | ||
+ | * v - value | ||
+ | * ts - timestamp - start of the value validity period | ||
+ | * gt - goodthrough - end of the value validity period | ||
+ | * i - interval, only present if it differs from the interval in Meta section | ||
+ | * Meta | ||
+ | * type - value type - double, string, datetime | ||
+ | * unit - unit | ||
+ | * interval - expected interval between the stored records. Useful to identify missing data. | ||
+ | |||
+ | <code javascript> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | **Demo** | ||
+ | <code javascript> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ==== [Depricated] | ||
**Request** | **Request** | ||
Line 138: | Line 327: | ||
</ | </ | ||
+ | |||
+ | ====api/ | ||
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | * Content-Type: | ||
+ | |||
+ | Attribute **i** sets **interval** ([[https:// | ||
+ | |||
+ | 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=" | ||
+ | < | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | projId=" | ||
+ | dpId=" | ||
+ | <n2:cred t=" | ||
+ | < | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Response** | ||
+ | |||
+ | * 200 OK | ||
+ | |||
+ | ====api/ | ||
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | * Content-Type: | ||
+ | |||
+ | Attribute **i** sets **interval** ([[https:// | ||
+ | |||
+ | 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=" | ||
+ | < | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | projId=" | ||
+ | dpId=" | ||
+ | from=" | ||
+ | to=" | ||
+ | <n2:cred t=" | ||
+ | < | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | <hv ts=" | ||
+ | < | ||
+ | </hv> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Response** | ||
+ | |||
+ | * 200 OK | ||
+ | |||
+ | ====api/ | ||
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | * Content-Type: | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | < | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | xmlns: | ||
+ | <n1:cred t=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | **Response** | ||
+ | |||
+ | <code xml><? | ||
+ | < | ||
+ | |||
+ | ====api/ | ||
+ | |||
+ | The right way how to retrieve current values of data points (property " | ||
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | |||
+ | <code javascript> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | **Response** | ||
+ | |||
+ | <code xml><? | ||
+ | <values xmlns: | ||
+ | < | ||
+ | <v projId=" | ||
+ | < | ||
+ | <d id=" | ||
+ | < | ||
+ | <p n=" | ||
+ | < | ||
+ | </p> | ||
+ | </ | ||
+ | </d> | ||
+ | <d id=" | ||
+ | < | ||
+ | <p n=" | ||
+ | < | ||
+ | </p> | ||
+ | </ | ||
+ | </d> | ||
+ | </ | ||
+ | </v> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====api/ | ||
+ | |||
+ | To get the list of datapoints. | ||
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | |||
+ | <code javascript> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | **Response** | ||
+ | |||
+ | <code xml><? | ||
+ | < | ||
+ | < | ||
+ | <dp id=" | ||
+ | < | ||
+ | < | ||
+ | <p n=" | ||
+ | <n1:r n2: | ||
+ | < | ||
+ | </ | ||
+ | <n1:w r: | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | <p n=" | ||
+ | < | ||
+ | </ | ||
+ | <p n=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <n3:p r: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | </dp> | ||
+ | <dp id=" | ||
+ | < | ||
+ | < | ||
+ | <p n=" | ||
+ | <n1:r n2: | ||
+ | < | ||
+ | </ | ||
+ | <n1:w r: | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | <p n=" | ||
+ | < | ||
+ | </ | ||
+ | <p n=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <n3:p r: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <def enabled=" | ||
+ | < | ||
+ | <status user=" | ||
+ | </ | ||
+ | </dp> | ||
+ | </ | ||
+ | </ | ||
===== Matlab Client ===== | ===== Matlab Client ===== | ||
==== General notes client function parameters ==== | ==== General notes client function parameters ==== |