# 8 消息

# 1 设置

# Webhook配置要求

# 一、协议要求
  • 支持协议: HTTPS
  • 加密要求: 建议使用 TLS 1.2 或 TLS 1.3 进行安全传输
  • 请求方法: POST
  • 内容类型: Content-Type: application/json
# 2. 响应规范
  • 成功状态码: 200 OK
  • 响应超时时间: 3秒
    (请避免在接收端执行耗时的业务逻辑,确保快速响应)

# 1.1 监听设置(POST)

消息监听,监听设置

# URL

https://developers.cjdropshipping.com/api2.0/v1/webhook/set

# CURL

curl --location --request POST 'https://developers.cjdropshipping.com/api2.0/v1/webhook/set' \
                --header 'CJ-Access-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
                --header 'Content-Type: application/json' \
                --data-raw '{
                    "product": {
                        "type": "ENABLE",
                        "callbackUrls": [
                            "https://your-host/api2.0/"
                        ]
                    },
                    "stock": {
                        "type": "ENABLE",
                        "callbackUrls": [
                            "https://your-host/api2.0/"
                        ]
                     },
                    "order": {
                        "type": "ENABLE",
                        "callbackUrls": [
                            "https://your-host/api2.0/"
                        ]
                    },
                    "logistics": {
                        "type": "ENABLE",
                        "callbackUrls": [
                            "https://your-host/api2.0/"
                        ]
                   }
                }'
参数名称 参数意义 参数类型 是否必传 长度 备注
product 商品消息 object 200 商品消息设置
- type 监听类型 string 200 ENABLE-启用,CANCEL-取消
- callbackUrls 监听接口 string[] 只支持单个监听
stock 库存消息 object 200 库存消息设置
- type 监听类型 string 200 ENABLE-启用,CANCEL-取消
- callbackUrls 监听接口 string[] 只支持单个监听
order 订单消息 object Y 200 订单消息设置
- type 监听类型 string Y 200 ENABLE-启用,CANCEL-取消
- callbackUrls 监听接口 string[] Y 只支持单个监听
logistics 物流轨迹消息 object Y 200 物流消息设置
- type 监听类型 string Y 200 ENABLE-启用,CANCEL-取消
- callbackUrls 监听接口 string[] Y 只支持单个监听

# 返回

success

{
    "code": 200,
    "result": true,
    "message": "Success",
    "data": true,
    "requestId": "97367e0f-cf3a-4c9b-acea-a36fb56f81b8"
}
返回字段 字段意思 字段类型 长度 备注
code 错误码 int 20 返回错误码标准表
result 是否正常返回 boolean 1
message 返回信息 string 200
data 是否设置成功 boolean 1 接口数据返回
requestId 请求Id string 48 用于日志查询错误

error

{
    "code": 1601000,
    "result": false,
    "message": "User not find",
    "data": null,
    "requestId": "a18c9793-7c99-42f9-970b-790eecdceba2"
}
返回字段 字段意思 字段类型 长度 备注
code 错误码 int 20 返回错误码标准表
result 是否正常返回 boolean 1
message 返回信息 string 200
data 接口数据返回
requestId 请求Id string 48 用于日志查询错误