帮助中心
帮助中心主页
HTTP API
Modbus API
常见问题
分页查询动作块信息

请求

  • 功能:通过参数分页查询系统内的动作块,查询参数中的 page 和 size 等均为示例,即本接口可以通过多种方式过滤和排序。
  • 方法:GET
  • 接口说明:/blocks
json
GET "http://host:8088/blocks"
1

请求参数

NameTypeDescriptionRequired
pagenumber页码数,如果不传默认为1
sizenumber每页动作块数量,如果不传默认为20
orderMethodstring排序方法,按照动作块更新时间排序。可以为 descending 和 ascending,默认为 descending 降序
whereobject string过滤条件,为 JSON 字符串,不传时不做过滤,详情见过滤条件

过滤条件

json
{
    "relation":"AND", // 表示多个查询条件的组合方式,支持AND, OR
    "predicates":[ // 每列的条件,格式为 [列名,操作符,值],三个字符串,支持的操作有:GT, LT, EQ, LIKE, NE, IN
        ["location", "EQ", "LM7"], // 点位为LM7
        ["operation", "EQ", "JackLoad"], // 动作为JackLoad
        ["state", "EQ", "FINISHED"] // 状态为 FINISHED
    ]
}
1
2
3
4
5
6
7
8

对于动作块,支持过滤的字段有:

  • id
  • scriptName
  • operation
  • state
  • location
  • goodsId

URL 编码

对于JSON中的特殊字符,需要使用百分号编码

编码前
json
{"relation":"AND","predicates":[["location","EQ","LM73"],["state","EQ","FINISHED"]]}
1

编码后
json
%7B%22relation%22%3A%22AND%22%2C%22predicates%22%3A%5B%5B%22location%22%2C%22EQ%22%2C%22LM73%22%5D%2C%5B%22state%22%2C%22EQ%22%2C%22FINISHED%22%5D%5D%7D
1

完整的请求示例
json
GET "http://host:8088/blocks?page=1&size=20&orderMethod=descending&where=%7B%22relation%22%3A%22AND%22%2C%22predicates%22%3A%5B%5B%22location%22%2C%22EQ%22%2C%22LM73%22%5D%2C%5B%22state%22%2C%22EQ%22%2C%22FINISHED%22%5D%5D%7D"
1

请求示例

响应

响应数据

NameTypeDescription
listobject array动作块信息数组,详情见查询动作块
pageint页码数,默认为1
sizeint每页条数,默认为20
totalint动作块的总数

响应示例

Responses Code 200

成功响应
json
{
    "list": [
        {
            "binTask": "",
            "blockId": "644d1760-4181-415d-a571-556ea8dc6b54",
            "goodsId": "",
            "location": "LM73",
            "operation": "",
            "operation_args": "null",
            "script_args": "null",
            "script_name": "",
            "state": "FINISHED"
        },
        {
            "binTask": "",
            "blockId": "69d2f402-b8aa-4aa6-86de-600753e0a45a",
            "goodsId": "",
            "location": "PP59",
            "operation": "",
            "operation_args": "null",
            "script_args": "null",
            "script_name": "",
            "state": "FINISHED"
        },
        {
            "binTask": "",
            "blockId": "b1",
            "goodsId": "",
            "location": "AP31",
            "operation": "",
            "operation_args": "null",
            "script_args": "null",
            "script_name": "",
            "state": "FINISHED"
        },
        {
            "binTask": "",
            "blockId": "c1e9c0c5-f608-4e49-beb3-f3ab5192c787",
            "goodsId": "",
            "location": "PP59",
            "operation": "",
            "operation_args": "null",
            "script_args": "null",
            "script_name": "",
            "state": "FINISHED"
        },
        {
            "binTask": "",
            "blockId": "6e62c16e-539d-417a-a84b-371a7ea0b6fa",
            "goodsId": "",
            "location": "PP59",
            "operation": "",
            "operation_args": "null",
            "script_args": "null",
            "script_name": "",
            "state": "FINISHED"
        }
    ],
    "page": 1,
    "size": 5,
    "total": 22
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

Responses Code 400

page 不为有效数字
json
{
    "code": 50003,
    "create_on": "2022-05-18T15:35:55.604Z",
    "msg": "query param page is illegal"
}
1
2
3
4
5

page 溢出
json
{
    "code": 50002,
    "create_on": "2022-05-18T15:36:30.722Z",
    "msg": "page out of range"
}
1
2
3
4
5

size 不为有效数字
json
{
    "code": 50003,
    "create_on": "2022-05-18T15:37:37.366Z",
    "msg": "query param size is illegal"
}
1
2
3
4
5

size 溢出
json
{
    "code": 50002,
    "create_on": "2022-05-18T15:38:02.768Z",
    "msg": "size out of range"
}
1
2
3
4
5

orderMethod 类型不支持
json
{
    "code": 50003,
    "create_on": "2022-05-18T15:40:03.539Z",
    "msg": "query param orderMethod is not supported"
}
1
2
3
4
5
最近更新 2022/11/28
文章内容

请求

请求参数

过滤条件

URL 编码

请求示例

响应

响应数据

响应示例

Responses Code 200

Responses Code 400