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 Both sides next revision
en:mervis-scada:50-api [2021/04/08 13:04]
127.0.0.1 external edit
en:mervis-scada:50-api [2021/04/15 10:43]
m.chlupac
Line 40: Line 40:
    * URL: /api/checkCredentials?format=xml    * URL: /api/checkCredentials?format=xml
    * Method: POST    * Method: POST
- 
-**Request** 
  
 <code javascript> <code javascript>
Line 56: Line 54:
   * You **should** use the received token **t** in subsequent API calls.   * You **should** use the received token **t** in subsequent API calls.
  
-====api/get/history====+ 
 + 
 +==== api/v3/get/history ==== 
 + 
 +**Request** 
 + 
 +   * URL: /api/v3/get/history?format=json 
 +   * Method: POST 
 +   * Downloading of one or multiple trends with single API call 
 +   * You should always use "token" instead of simple "name" a "password". Non-token call is slower. 
 +   * "seriesParameters" [optional] - use only if you request different parameters than "commonSeriesParameters" 
 +   * "clientReference" [optional] - use for your own identification of the series 
 +   * Items: "segmenation", "requestState" and "serverState" should always copy the values from the last server response. First call should use empty "segmentation"
 + 
 + 
 +<code javascript> 
 +
 +    "credentials":
 +        "token":"guid" //string 
 +    }, 
 +    "request":
 +        "commonSeriesParameters":
 +            "from": "2018-12-01T00:00:00Z", //UTC dateTime 
 +            "to": "2018-12-01T10:00:00Z"//UTC dateTime 
 +        }, 
 +        "series":
 +            { 
 +                "seriesParameters":
 +                    "from": "2017-11-28T14:26:16.5029619Z",//UTC dateTime 
 +                    "to": "2018-11-28T14:26:16.5029619Z" //UTC dateTime 
 +                }, 
 +                "clientReference": "myId2a", //string 
 +                "provider":
 +                    "parameters":
 +                        "projectId": "5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0", //guid 
 +                        "dataPointId": "2a9c26c9-2ce3-49c4-909d-9ac1143121f1" //guid 
 +                    } 
 +                } 
 +            }, 
 +            { 
 +                "clientReference": "myId1a", 
 +                "provider":
 +                    "parameters":
 +                        "projectId": "5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0", 
 +                        "dataPointId": "62cf4083-31ed-4bc1-be25-044ba837a9f0" 
 +                    } 
 +                } 
 +            } 
 +        ] 
 +    }, 
 +    "dataSpecification":
 +        "limits":
 +            "count": 1000 //int 
 +        } 
 +    }, 
 +    "segmentation":
 +        "requestState": ";;2;;0", //string 
 +        "serverState": "xyz" //string 
 +    } 
 +
 +</code> 
 + 
 +**Response** 
 + 
 +   * Empty "segmentation" ("requestState") marks response containing last data of the requested series 
 +   * "requestState" and "serverState" must be copied to the next API call 
 +   * 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> 
 +
 +"result":
 +        "code": 0, //int 
 +        "subCode": 0, //int 
 +        "message": "" //string 
 +    }, 
 +    "data":
 +        "count": 3, //int 
 +        "historyData":
 +            { 
 +                "clientReference": "myId2a", //string 
 +                "provider":
 +                    "id": "689e32fa-24a2-448e-9374-6158e6e6cb15", //guid 
 +                    "parameters":
 +                        "projectId": "5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0", //guid 
 +                        "dataPointId": "2a9c26c9-2ce3-49c4-909d-9ac1143121f1" //guid 
 +                    } 
 +                }, 
 +                "meta":
 +                    "type": "string", //string 
 +                    "unit": "", //string 
 +                    "interval": "PT3M" //string - ISO8601 Timespan 
 +                }, 
 +                "values":
 +                    { 
 +                        "v": "AUT", //string 
 +                        "ts": "2018-11-26T12:22:15.25795Z", //dateTime 
 +                        "gt": "2018-11-26T13:22:15.5784067Z" //dateTime 
 +                    } 
 +                ] 
 +            }, 
 +            { 
 +                "clientReference": "myId1a", 
 +                "provider":
 +                    "parameters":
 +                        "projectId": "5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0", 
 +                        "dataPointId": "62cf4083-31ed-4bc1-be25-044ba837a9f0" 
 +                    } 
 +                }, 
 +                "meta":
 +                    "type": "double", 
 +                    "unit": "hod", 
 +                    "interval": "PT3M" 
 +                }, 
 +                "values":
 +                    { 
 +                        "v": 12939,//double 
 +                        "ts": "2018-11-30T23:58:15.2394603Z", 
 +                        "gt": "2018-12-01T01:37:15.4869553Z" 
 +                    }, 
 +                    { 
 +                        "v": 12946, 
 +                        "ts": "2018-12-01T09:22:16.2049051Z", 
 +                        "gt": "2018-12-01T10:37:15.4023519Z", 
 +                        "i": "PT4M" 
 +                    } 
 +                ] 
 +            } 
 +        ] 
 +    }, 
 +    "segmentation":
 +        "requestState": "xyz", //string 
 +        "serverState": "xyz" //string 
 +    } 
 +
 + 
 + 
 +</code> 
 + 
 +**Demo** 
 +<code javascript> 
 +
 +    "credentials":
 +        "name": "demo", 
 +        "password": "demo" 
 +    }, 
 +    "request":
 +        "commonSeriesParameters":
 +            "from": "2018-12-01T00:00:00Z", 
 +            "to": "2018-12-01T00:11:00Z" 
 +        }, 
 +        "series":
 +            { 
 +                "clientReference": "myId1", 
 +                "provider":
 +                    "parameters":
 +                        "projectId": "5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0", 
 +                        "dataPointId": "acad79f3-3358-42dd-9b74-98733e63d771" 
 +                    } 
 +                } 
 +            }, 
 +            { 
 +                "clientReference": "myId2", 
 +                "provider":
 +                    "parameters":
 +                        "projectId": "5abf8ca0-94ba-48df-8d3c-7ebe87a12fd0", 
 +                        "dataPointId": "14cf0dbb-b050-43aa-a6f0-22886c33ed8e" 
 +                    } 
 +                } 
 +            } 
 +        ] 
 +    }, 
 +    "dataSpecification":
 +        "limits":
 +            "count": 1000 
 +        } 
 +    } 
 +
 + 
 +</code> 
 + 
 + 
 +==== [Depricated] api/get/history====
  
 **Request** **Request**
  • © Energocentrum Plus, s.r.o. 2017 - 2024