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/03/12 08:32] m.chlupac [setDataPointValue] |
en:mervis-scada:50-api [2023/09/26 14:39] v.kohout [api/v3/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 [[: | 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/ |
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | |||
+ | <code javascript> | ||
+ | {" | ||
+ | </ | ||
+ | |||
+ | **Response** | ||
+ | |||
+ | <code xml> | ||
+ | <?xml version=" | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | * You **should** use the received token **t** in subsequent API calls. | ||
+ | |||
+ | |||
+ | |||
+ | ==== 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> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== api/ | ||
+ | |||
+ | **Request** | ||
+ | |||
+ | * URL: / | ||
+ | * Method: POST | ||
+ | * You should always use " | ||
+ | * " | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | * " | ||
+ | |||
+ | |||
+ | <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> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== [Depricated] | ||
**Request** | **Request** | ||
Line 116: | Line 484: | ||
</ | </ | ||
+ | |||
+ | ====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 ==== | ||
Line 163: | Line 822: | ||
Sets data point value using a button (primary the INIT button). Only numerical values are supported. Parameter buttonName is not mandatory. Value ' | Sets data point value using a button (primary the INIT button). Only numerical values are supported. Parameter buttonName is not mandatory. Value ' | ||
+ | {{ : | ||
**Example: | **Example: | ||
Line 168: | Line 828: | ||
dpGuid = ' | dpGuid = ' | ||
projectId = ' | projectId = ' | ||
- | buttonName = ' | + | buttonName = ' |
newValue = 1; | newValue = 1; | ||
scada = ScadaClient(' | scada = ScadaClient(' | ||
- | scada.setDataPointValue(projectId, | + | scada.setDataPointValue(projectId, |
</ | </ |