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
Previous revision
en:mervis-scada:50-api [2023/09/26 14:19]
v.kohout [api/set/history]
en:mervis-scada:50-api [2023/09/26 14:42] (current)
v.kohout [api/get/history/specific]
Line 15: Line 15:
 ^api/get/history/specific|| ^api/get/history/specific||
 ^api/set/history|| ^api/set/history||
 +^api/replace/history||
 ^api/get/values|| ^api/get/values||
 ^api/get/alarms|| ^api/get/alarms||
Line 242: Line 243:
 </code> </code>
  
 +==== api/get/history/specific ====
 +
 +**Request**
 +
 +   * URL: /api/get/history/specific?format=json
 +   * Method: POST
 +   * You should always use token ("t") instead of simple name and password ("n" and "p"). Non-token call is slower.
 +   * "dataSpec" - data specification
 +      MinTimestamp = 0,
 +      MaxTimestamp = 1,
 +      FirstLessThanReferenceDateTime = 2,
 +      FirstLessThanOrEqualThanReferenceTime = 3,
 +      FirstGreaterThanReferenceDateTime = 4,
 +      FirstGreaterThanOrEqualThanReferenceTime = 5,
 +      MaxGoodThroughTime = 6 
 +   * "refTime" [optional] - reference time for dataSpec values 2 to 5
 +
 +
 +<code javascript>
 +{
 + "cred":
 + {
 +  "n":"test",
 +  "p":"test"
 + },
 +  "projId":"b4d96a6d-2b3d-48eb-af30-d11e875ba7ed",
 +  "offset":0,
 +  "count":1000,
 +  "dataSpec":2, 
 +  "refTime":"\/Date(1692788459000)\/",
 +  "dpIds":["58426e69-46ba-4925-9a5c-d7d65efb9886","f4501a2e-62ed-430e-9346-5e155e730fe3","28e7d087-917a-456a-9d02-96882f572286"]
 +}
 +</code>
 +
 +**Response**
 +
 +   * Values
 +     * v - value
 +     * ts - timestamp - start of the value validity period
 +     * gt - goodthrough - end of the value validity period
 +     * i - interval
 +
 +<code javascript>
 +{
 +    "ns": {
 +        "r": "http://dev.rcware.eu/serialization/references",
 +        "n1": "http://dev.rcware.eu/scada/history",
 +        "n2": "http://dev.rcware.eu/scada/datapoints",
 +        "n3": "http://dev.rcware.eu/scada/basic-props"
 +    },
 +    "doc": {
 +        "n1:getHistorySpecificResult": {
 +            "n2:pl": [
 +                {
 +                    "n2:p": {
 +                        "n1:hist": {
 +                            "@": {
 +                                "n1:projId": "b4d96a6d-2b3d-48eb-af30-d11e875ba7ed",
 +                                "n1:dpId": "58426e69-46ba-4925-9a5c-d7d65efb9886",
 +                                "n1:propName": "Output",
 +                                "n1:interval": "00:00:00",
 +                                "n1:historyState": "",
 +                                "n1:nextValOfs": 0
 +                            },
 +                            "n1:errMsg": "",
 +                            "n1:vals": [
 +                                {
 +                                    "n1:hv": {
 +                                        "@": {
 +                                            "n1:ts": "2023-08-23T11:00:57.7010708Z",
 +                                            "n1:i": "1.00:00:00"
 +                                        },
 +                                        "n3:v": 12.48
 +                                    }
 +                                }
 +                            ]
 +                        },
 +                        "@": {
 +                            "r:type": "b133774d-21ce-42b6-add3-57c012079c55"
 +                        }
 +                    }
 +                },
 +                {
 +                    "n2:p": {
 +                        "n1:hist": {
 +                            "@": {
 +                                "n1:projId": "b4d96a6d-2b3d-48eb-af30-d11e875ba7ed",
 +                                "n1:dpId": "f4501a2e-62ed-430e-9346-5e155e730fe3",
 +                                "n1:propName": "Output",
 +                                "n1:interval": "00:00:00",
 +                                "n1:historyState": "",
 +                                "n1:nextValOfs": 0
 +                            },
 +                            "n1:errMsg": "",
 +                            "n1:vals": [
 +                                {
 +                                    "n1:hv": {
 +                                        "@": {
 +                                            "n1:ts": "2023-08-23T10:38:43.784Z",
 +                                            "n1:gt": "2023-08-23T11:18:00.207Z",
 +                                            "n1:i": "00:00:30"
 +                                        },
 +                                        "n3:v": 5.0
 +                                    }
 +                                }
 +                            ]
 +                        },
 +                        "@": {
 +                            "r:type": "b133774d-21ce-42b6-add3-57c012079c55"
 +                        }
 +                    }
 +                },
 +                {
 +                    "n2:p": {
 +                        "n1:hist": {
 +                            "@": {
 +                                "n1:projId": "b4d96a6d-2b3d-48eb-af30-d11e875ba7ed",
 +                                "n1:dpId": "28e7d087-917a-456a-9d02-96882f572286",
 +                                "n1:propName": "Output",
 +                                "n1:interval": "00:00:00",
 +                                "n1:historyState": "",
 +                                "n1:nextValOfs": 0
 +                            },
 +                            "n1:errMsg": "",
 +                            "n1:vals": [
 +                                {
 +                                    "n1:hv": {
 +                                        "@": {
 +                                            "n1:ts": "2023-08-23T10:38:43.786Z",
 +                                            "n1:gt": "2023-08-23T11:18:00.207Z",
 +                                            "n1:i": "00:00:30"
 +                                        },
 +                                        "n3:v": "ZAP"
 +                                    }
 +                                }
 +                            ]
 +                        },
 +                        "@": {
 +                            "r:type": "177e726a-3180-4152-bef2-6254e7055e1f"
 +                        }
 +                    }
 +                }
 +            ],
 +            "@": {
 +                "r:type": "1c4c1ddc-463f-443d-883a-19489cd2e53a"
 +            }
 +        }
 +    }
 +}
 +
 +</code>
  
 ==== [Depricated] api/get/history==== ==== [Depricated] api/get/history====
  • © Energocentrum Plus, s.r.o. 2017 - 2024