Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
en:mervis-ide:65-webpanel:webpanel-api [2017/06/21 11:01] m.chlupac |
en:mervis-ide:65-webpanel:webpanel-api [2024/05/08 10:42] (current) |
||
|---|---|---|---|
| Line 7: | Line 7: | ||
| ==== Request ==== | ==== Request ==== | ||
| - | Data: | + | **URL:** '' |
| - | '' | + | |
| + | <code javascript> | ||
| + | ver : 1,// | ||
| + | //optional - only for non-authenticated access | ||
| + | // | ||
| + | c: {u: " | ||
| + | }</ | ||
| + | |||
| + | ==== Response ==== | ||
| + | |||
| + | <code javascript> | ||
| + | ver : 1,// | ||
| + | code: " | ||
| + | msg: "", | ||
| + | c : {u: " | ||
| + | }</ | ||
| + | |||
| + | ===== Data request ===== | ||
| + | |||
| + | ==== Request ==== | ||
| + | |||
| + | **URL:** '' | ||
| + | |||
| + | <code javascript> | ||
| + | ver : 1,// | ||
| + | //optional - only for non-authenticated access | ||
| + | // | ||
| + | c: {u: " | ||
| + | //variable IDs | ||
| + | v: [ " | ||
| + | " | ||
| + | }</ | ||
| + | |||
| + | * variable ID is unique string - in future, may be different for different platforms/ | ||
| + | |||
| + | === Example === | ||
| + | |||
| + | <code javascript> | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Variable specification for Mervis RT === | ||
| + | |||
| + | * 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. | ||
| + | * Variable id: it has a form of commUID[offset, | ||
| + | * Example: < | ||
| + | * Represents a variable with the commUID 8776. 2 bytes from the offset 0 are returned. | ||
| + | |||
| + | the POST body can be: | ||
| + | |||
| + | - JSON string (AngularJS default behaviour): <code javascript> | ||
| + | - converted into POST parameters (jQuery default behaviour):< | ||
| + | |||
| + | |||
| + | ==== Response ==== | ||
| + | |||
| + | <code javascript> | ||
| + | ver : 1,// | ||
| + | code: " | ||
| + | msg: "", | ||
| + | v: [{ | ||
| + | i: " | ||
| + | v: " | ||
| + | q: " | ||
| + | t: 654654321654 //timestamp UTC, milliseconds since 1970 | ||
| + | } | ||
| + | ] | ||
| + | }</ | ||
| + | |||
| + | === Encoding of values - version 1 === | ||
| + | |||
| + | * Each value is transmitted as a big endian binary representation of the specified variable (and its offset and length). | ||
| + | |||
| + | === Example === | ||
| + | |||
| + | <code javascript> | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | : " | ||
| + | " | ||
| + | }, { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | }</ | ||
| + | |||
| + | |||
| + | ===== Command Request ===== | ||
| + | |||
| + | ==== Request ==== | ||
| + | |||
| + | **URL: | ||
| + | |||
| + | <code javascript> | ||
| ver : 1,//version | ver : 1,//version | ||
| - | //optional - only for non-authenticated access | + | //optional - only for non-authenticated access |
| // | // | ||
| - | c: {u: “karel”, p: “x”} | + | c: {u: "karel", p: "x"}, |
| - | + | v: [{ | |
| - | }'' | + | i: " |
| - | ==== Response ==== | + | // |
| + | time: " | ||
| + | | ||
| + | | ||
| + | // | ||
| + | set: 5, | ||
| + | // | ||
| + | // | ||
| + | | ||
| + | } | ||
| + | ] | ||
| + | }</ | ||
| - | { | + | * Warning : only one variable is expected in the request for the tiniest (uPLC) platforms - other variables are ignored |
| + | |||
| + | ===== Historical Data Request ===== | ||
| + | |||
| + | ==== Request ==== | ||
| + | |||
| + | **URL:** '' | ||
| + | |||
| + | <code javascript> | ||
| ver : 1,//version | ver : 1,//version | ||
| - | code: “ok”, //return | + | // |
| - | msg: “”, //error message | + | // |
| - | c : {u: “karel”, p:”x”} //must be used for further communication | + | c: {u: " |
| + | v: [ {i:" | ||
| + | from: XXXX, | ||
| + | to: YYYY | ||
| + | }, | ||
| + | | ||
| + | from: XXXX, | ||
| + | to: YYYY | ||
| + | } | ||
| + | ] | ||
| + | }</code> | ||
| + | |||
| + | ==== Response ==== | ||
| + | |||
| + | <code javascript> | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | }], | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | | ||
| + | }] | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Native/ | ||
| + | Note: big endian encoding (v1) | ||
| + | * integer (represents int8-int64) | ||
| + | * unsigned integer (represents uint8-uint64) | ||
| + | * double (double64) | ||
| + | * float (float32) | ||
| + | * bool (boolean - 0 ~ false, 1 ~ true) | ||
| + | * dt (date time - the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001) | ||
| + | * time (time - the number of 100-nanosecond intervals) | ||
| + | * Enums are encoded into 32-bit int | ||