文档
测试

获取历史数据

POST
api_jsonrpc.php

请求头

参数名
类型
描述
必填
Content-Type
String
请求的 Content-Type 头部必须设置为以下值之一: application/json-rpc, application/json 或 application/jsonrequest
必填

请求参数

参数名
类型
描述
必填
jsonrpc
String
API使用的JSON-RPC协议的版本; API实现JSON-RPC版本2.0;
必填
method
String
调用的API方法; history.get
必填
params
JSON
请求传递参数
必填
output
String
定义所需输出的参数。
必填
history
integer
History object types to return. 要返回的历史对象类型。 Possible values:可能的值 0 - numeric float;数字浮点数 1 - character;字符 2 - log; 日志 3 - numeric unsigned; 数字符号 4 - text.文本 Default: 3.默认:3;
必填
itemids
String
只返回给定项的历史记录。
必填
sortfield
String
按照给定的属性对结果进行排序。
必填
sortorder
String
排序方式
必填
limit
integer
获取数据的行数
必填
id
String
请求的任意标识符;
必填
auth
String
用户认证令牌;
必填

响应参数

参数名
类型
描述
必填
jsonrpc
string
示例:2.0 JSON-RPC协议的版本;
必填
result
array
数据列表 方法返回的数据;
必填
itemid
string
示例:23296 相关项的ID。
必填
clock
string
示例:1351090996 收到这个值的时间
必填
value
string
示例:0.0850 获取值。
必填
ns
string
示例:563157632 . 收到值时的纳秒。
必填
id
number
示例:1 相应请求的标识符。
必填

说明 / 示例

请求示例 { "jsonrpc": "2.0", "method": "history.get", "params": { "output": "extend", "history": 0, "itemids": "23296", "sortfield": "clock", "sortorder": "DESC", "limit": 10 }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 } 返回结果 { "jsonrpc": "2.0", "result": [ { "itemid": "23296", "clock": "1351090996", "value": "0.0850", "ns": "563157632" }, { "itemid": "23296", "clock": "1351090936", "value": "0.1600", "ns": "549216402" }, { "itemid": "23296", "clock": "1351090876", "value": "0.1800", "ns": "537418114" }, { "itemid": "23296", "clock": "1351090816", "value": "0.2100", "ns": "522659528" }, { "itemid": "23296", "clock": "1351090756", "value": "0.2150", "ns": "507809457" }, { "itemid": "23296", "clock": "1351090696", "value": "0.2550", "ns": "495509699" }, { "itemid": "23296", "clock": "1351090636", "value": "0.3600", "ns": "477708209" }, { "itemid": "23296", "clock": "1351090576", "value": "0.3750", "ns": "463251343" }, { "itemid": "23296", "clock": "1351090516", "value": "0.3150", "ns": "447947017" }, { "itemid": "23296", "clock": "1351090456", "value": "0.2750", "ns": "435307141" } ], "id": 1 }