---
title: "协议脚本调试"
method: POST
path: "/api/v1/things/protocol/script/debug"
tags: ["things/protocol/script", "thingsProtocolScript"]
---

# 协议脚本调试

`POST /api/v1/things/protocol/script/debug`

## Request body

- ProtocolScriptDebugReq
  - `req` PublishMsg, required
    - `deviceName` string
    - `explain` string — 内部使用的拓展字段
    - `handle` string — 对应 mqtt topic的第一个 thing ota config 等等
    - `payload` string
    - `productID` string
    - `protocolCode` string — 如果有该字段则回复的时候也会带上该字段
    - `timestamp` string — 毫秒时间戳
    - `type` string — 操作类型 从topic中提取 物模型下就是 property属性 event事件 action行为
  - `resp` PublishMsg
    - `deviceName` string
    - `explain` string — 内部使用的拓展字段
    - `handle` string — 对应 mqtt topic的第一个 thing ota config 等等
    - `payload` string
    - `productID` string
    - `protocolCode` string — 如果有该字段则回复的时候也会带上该字段
    - `timestamp` string — 毫秒时间戳
    - `type` string — 操作类型 从topic中提取 物模型下就是 property属性 event事件 action行为
  - `script` string, required — 脚本内容
  - `triggerDir` integer, required — 1:up 2:down
  - `triggerTimer` integer, required — 收到前处理1:before 2:after

## Response `200`

A successful response.

- object
  - `code` integer
  - `data` ProtocolScriptDebugResp
    - `logs` string[], required
    - `out` PublishMsg, required
      - `deviceName` string
      - `explain` string — 内部使用的拓展字段
      - `handle` string — 对应 mqtt topic的第一个 thing ota config 等等
      - `payload` string
      - `productID` string
      - `protocolCode` string — 如果有该字段则回复的时候也会带上该字段
      - `timestamp` string — 毫秒时间戳
      - `type` string — 操作类型 从topic中提取 物模型下就是 property属性 event事件 action行为
  - `msg` string

---

[API](https://skmtc.net/unitedrhino/apis/things-api.md) · [All operations](https://skmtc.net/unitedrhino/apis/things-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unitedrhino/things-api/revisions/f3bdeb916389/schema)
