主要内容

本页采用了机器翻译。点击此处可查看英文原文。

Get All TalkBack Commands

从 TalkBack 队列获取所有 TalkBack 命令

请求

HTTP 方法

GET

URL

https://api.thingspeak.com/talkbacks/<talkback_id>/commands/.<format>

输入参量

名称描述

<talkback_id>

(必填)TalkBack ID,指定为正整数。

<format>

HTTP 响应的格式,指定为 json 或 xml。

示例: https://api.thingspeak.com/talkbacks/12345/commands.json

查询字符串参数

名称描述值类型
api_key

(必需)此特定 TalkBack 实例的 API 密钥。TalkBack 密钥与通道和用户 API 密钥不同。

字符串

Content-Type

application/x-www-form-urlencoded

响应

成功

HTTP 状态代码

200 OK

主体

示例响应基于此示例 TalkBack 队列。

将 <format> 指定为空白以接收文本格式的响应。

GET https://api.thingspeak.com/talkbacks/12345/commands?api_key=XXXXXXXXXXXXXXXX

示例响应

"OPENDOOR","CLOSEDOOR","BUCLKESHOE"
GET https://api.thingspeak.com/talkbacks/12345/commands.json?api_key=XXXXXXXXXXXXXXXX

响应

[
{
"id": 15200360,
"command_string": "OPENDOOR",
"position": 1,
"executed_at": null,
"created_at": "2019-02-20T14:22:02Z"
},
{
"id": 15200361,
"command_string": "CLOSEDOOR",
"position": 2,
"executed_at": null,
"created_at": "2019-02-20T14:22:07Z"
},
{
"id": 15200362,
"command_string": "BUCKLESHOE",
"position": 3,
"executed_at": null,
"created_at": "2019-02-20T14:25:02Z"
}
]
GET https://api.thingspeak.com/talkbacks/12345/commands/2448500.xml?api_key=XXXXXXXXXXXXXXXX

响应

<commands type="array">
<command>
<id type="integer">15200360</id>
<command-string>OPENDOOR</command-string>
<position type="integer">1</position>
<executed-at type="dateTime" nil="true"/>
<created-at type="dateTime">2019-02-20T14:22:02Z</created-at>
</command>
<command>
<id type="integer">15200361</id>
<command-string>roofCLOSEDOORinteger">2</position>
<executed-at type="dateTime" nil="true"/>
<created-at type="dateTime">2019-02-20T14:22:07Z</created-at>
</command>
<command>
<id type="integer">15200362</id>
<command-string>BUCKLESHOE</command-string>
<position type="integer">3</position>
<executed-at type="dateTime" nil="true"/>
<created-at type="dateTime">2019-02-20T14:25:02Z</created-at>
</command>
</commands>

错误

完整列表请参阅错误代码。