主要内容

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

Get Last Executed TalkBack Command

从 TalkBack 队列获取最后执行的 TalkBack 命令

请求

HTTP 方法

GET

URL

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

输入参量

名称描述

<talkback_id>

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

<format>

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

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

查询字符串参数

名称描述值类型
api_key

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

字符串

Content-Type

application/x-www-form-urlencoded

响应

成功

HTTP 状态代码

200 OK

主体

将 <format> 留空以文本格式接收响应。

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

示例响应

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

响应

{
  "command_string": "OPENDOOR",
  "created_at": "2018-12-29T17:53:40-05:00",
  "executed_at": "2018-12-30T17:53:40-05:00",
  "id": 2446323,
  "position": null
}
GET https://api.thingspeak.com/talkbacks/12345/commands/last.xml?api_key=XXXXXXXXXXXXXXXX

响应

<?xml version="1.0" encoding="UTF-8"?>
<command>
  <id type="integer">2446323</id>
  <command-string>OPENDOOR</command-string>
  <position type="integer" nil="true"/>
  <created-at type="datetime">2013-12-30T16:51:17-05:00</created-at>
  <executed-at type="datetime">2013-12-31T16:51:17-05:00</executed-at>
</command>

错误

如果没有针对此 TalkBack 实例执行过任何命令,则请求将返回 HTTP 状态代码 404 和 error_resource_not_found。

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