# 08. Webhook

# 1 Setting

# Webhook Configuration Requirements

# 1. Protocol Requirements
  • Supported Protocols: HTTPS
  • Encryption: TLS 1.2 or TLS 1.3 recommended for secure transmission
  • Request Method: POST
  • Content Type: Content-Type: application/json
# 2. Response Specifications
  • Success Status Code: 200 OK
  • Timeout: Response must be returned within 3 seconds
    (Avoid long-running or complex business logic to ensure prompt response)
  • URL Validation: The callback URL must be a public HTTPS address. Local addresses such as localhost and 127.0.0.1 are not supported.
  • Failure Message: If URL validation fails, the message field will return the concrete reason directly.

# 1.1 Message Setting(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/"
                        ]
                    }
                }'
Parameter Definition Type Required Length Note
product Product Message object Y 200 Product Message Setting
- type Product Message type string Y 200 ENABLE,CANCEL
- callbackUrls callback url string[] Y 1 Only one callback URL is supported, and it must be a reachable public HTTPS URL
stock Stock Message object Y 200 Stock Message Setting
- type Stock Message type string Y 200 ENABLE,CANCEL
- callbackUrls callback url string[] Y 1 Only one callback URL is supported, and it must be a reachable public HTTPS URL
order Order Message object Y 200 Order Message Setting
- type Message type string Y 200 ENABLE,CANCEL
- callbackUrls callback url string[] Y 1 Only one callback URL is supported, and it must be a reachable public HTTPS URL
logistics Logistics Message object Y 200 Logistics Message Setting
- type Message type string Y 200 ENABLE,CANCEL
- callbackUrls callback url string[] Y 1 Only one callback URL is supported, and it must be a reachable public HTTPS URL

# Result

success

{
    "code": 200,
    "result": true,
    "message": "Success",
    "data": true,
    "requestId": "97367e0f-cf3a-4c9b-acea-a36fb56f81b8",
    "success": true
}
Field Definition Type Length Note
code error code int 20 Reference error code
result Whether or not the return is normal boolean 1
message return message string 200
data return data object interface data return
requestId requestId string 48 Flag request for logging errors
success whether the call succeeded boolean 1 true-success, false-failed

error

{
    "code": 1607001,
    "result": false,
    "message": "Please do not use domain names such as localhost, 127.0.0.1",
    "data": null,
    "requestId": "a18c9793-7c99-42f9-970b-790eecdceba2",
    "success": false
}
Field Definition Type Length Note
code error code int 20 Reference error code
result Whether or not the return is normal boolean 1
message return message string 200
data return data object interface data return
requestId requestId string 48 Flag request for logging errors
success whether the call succeeded boolean 1 true-success, false-failed