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-ide:65-webpanel:webpanel-api [2017/06/21 11:00] m.chlupac |
en:mervis-ide:65-webpanel:webpanel-api [2019/05/21 09:45] m.chlupac [Request] |
||
---|---|---|---|
Line 2: | Line 2: | ||
Communication is based on HTTP protocol. Clients send HTTP POST request and get the response depending on the request. Each request must specify the credentials in case the credentials are specified for the project. | Communication is based on HTTP protocol. Clients send HTTP POST request and get the response depending on the request. Each request must specify the credentials in case the credentials are specified for the project. | ||
+ | |||
===== Login ===== | ===== Login ===== | ||
==== Request ==== | ==== Request ==== | ||
- | Data: | + | <code js>{ |
- | '' | + | ver : 1,// |
- | ver : 1,// | + | //optional - only for non-authenticated access |
- | //optional - only for non-authenticated access | + | // |
- | // | + | c: {u: “karel”, |
- | c: {u: “karel”, | + | }</ |
- | + | ||
- | }'' | + | |
==== Response ==== | ==== Response ==== | ||
- | { | + | <code js>{ |
- | ver : 1,// | + | ver : 1,// |
- | code: “ok”, //return code | + | code: “ok”, //return code |
- | msg: “”, //error message | + | msg: “”, //error message |
- | c : {u: “karel”, | + | c : {u: “karel”, |
- | } | + | }</ |
===== Data request ===== | ===== Data request ===== | ||
Line 27: | Line 27: | ||
==== Request ==== | ==== Request ==== | ||
- | Data: | + | **URL:** '' |
- | '' | + | |
- | ver : 1,// | + | <code js>{ |
- | //optional - only for non-authenticated access | + | ver : 1,// |
- | // | + | //optional - only for non-authenticated access |
- | c: {u: “karel”, | + | // |
- | //variable IDs | + | c: {u: “karel”, |
- | v: [ “svc:// | + | //variable IDs |
+ | v: [ “svc:// | ||
| | ||
- | }'' | + | }</ |
* variable ID is unique string - in future, may be different for different platforms/ | * variable ID is unique string - in future, may be different for different platforms/ | ||
- | === Variable specification for RT2 === | + | === Variable specification for Mervis RT === |
* svc - protocol | * svc - protocol | ||
* Connection - generally, clients can request data from more sources (more or less corresponds to a connection definition of PLC). For local data (data belonging to the PLC that executes the request) it may be defaultconnection. | * Connection - generally, clients can request data from more sources (more or less corresponds to a connection definition of PLC). For local data (data belonging to the PLC that executes the request) it may be defaultconnection. | ||
* Variable id: it has a form of commUID[offset, | * Variable id: it has a form of commUID[offset, | ||
- | * Example: svc:// | + | * Example: |
* Represents a variable with the commUID 8776. 2 bytes from the offset 0 are returned. | * Represents a variable with the commUID 8776. 2 bytes from the offset 0 are returned. | ||
the POST body can be: | the POST body can be: | ||
- | - JSON string (AngularJS default behaviour): | + | - JSON string (AngularJS default behaviour): |
- | '' | + | - converted into POST parameters (jQuery default behaviour):< |
- | - converted into POST parameters (jQuery default behaviour): | + | |
- | '' | + | |
- | The best solution would be to support both versions. Easier is now the JSON string. | ||
==== Response ==== | ==== Response ==== | ||
- | '' | + | <code js>{ |
- | ver : 1,// | + | ver : 1,// |
- | code: | + | |
- | msg: “”, //error message | + | |
v: [{ | v: [{ | ||
- | | + | |
- | | + | |
- | | + | |
- | t: 654654321654 //timestamp UTC, milliseconds since 1970 | + | |
} | } | ||
] | ] | ||
- | }'' | + | }</ |
=== Encoding of values - version 1 === | === Encoding of values - version 1 === | ||
- | Ea | + | |
===== Command Request ===== | ===== Command Request ===== | ||
Line 81: | Line 79: | ||
- | '' | + | <code js>{ |
ver : 1,//version | ver : 1,//version | ||
// | // | ||
Line 99: | Line 97: | ||
} | } | ||
] | ] | ||
- | }'' | + | }</ |
* Warning : only one variable is expected in the request for the tiniest (uPLC) platforms - other variables are ignored | * Warning : only one variable is expected in the request for the tiniest (uPLC) platforms - other variables are ignored | ||
Line 107: | Line 105: | ||
==== Request ==== | ==== Request ==== | ||
- | '' | + | <code js>{ |
ver : 1,//version | ver : 1,//version | ||
// | // | ||
Line 121: | Line 119: | ||
} | } | ||
] | ] | ||
- | }'' | + | }</ |
Line 127: | Line 125: | ||
===== Configuration Response ===== | ===== Configuration Response ===== | ||
- | '' | + | <code js>{ |
- | ver : 1,// | + | ver : 1,// |
- | platform: “uPLC”, | + | platform: “uPLC”, |
- | maxVariablesInRequest: | + | maxVariablesInRequest: |
- | maxRequestSize: | + | maxRequestSize: |
- | preferedLanguage: | + | preferedLanguage: |
- | }'' | + | }</ |
- | ====== Native/ | + | ===== Native/ |
Note: big endian encoding (v1) | Note: big endian encoding (v1) |