Search…
API Reference
Resources
Update a webhook
How to update an existing webhook via API
To update an existing webhook, send a PATCH request to the /api/webhooks/:id endpoint, where id is the ID of the resource that you want to update.
Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/webhooks/:id

Arguments

Body Parameter
Type
Required
type
string
Required
id
string
Required
attributes.name
string
Optional
attributes.topic
string
Optional
attributes.callback_url
string
Optional
attributes.include_resources
array
Optional
attributes._reset_circuit
boolean, value is 'true'
Optional
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional

Example

Request
Response
The following request updates the webhook identified by the ID "xYZkjABcde":
1
curl -g -X PATCH \
2
'https://yourdomain.commercelayer.io/api/webhooks/xYZkjABcde' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "webhooks",
9
"id": "xYZkjABcde",
10
"attributes": {
11
"include_resources": [
12
"customer",
13
"shipping_address",
14
"billing_address"
15
]
16
}
17
}
18
}'
Copied!
On success, the API responds with a 200 OK status code, returning the updated resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "webhooks",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/webhooks/xYZkjABcde"
7
},
8
"attributes": {
9
"name": "myorg-orders.place",
10
"topic": "orders.place",
11
"callback_url": "https://yourapp.com/webhooks",
12
"include_resources": [
13
"customer",
14
"shipping_address",
15
"billing_address"
16
],
17
"circuit_state": "closed",
18
"circuit_failure_count": 5,
19
"created_at": "2018-01-01T12:00:00.000Z",
20
"updated_at": "2018-01-01T12:00:00.000Z",
21
"reference": "ANY-EXTERNAL-REFEFERNCE",
22
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
23
"metadata": {
24
"foo": "bar"
25
}
26
},
27
"relationships": {
28
"last_event_callbacks": {
29
"links": {
30
"self": "https://yourdomain.commercelayer.io/api/webhooks/xYZkjABcde/relationships/last_event_callbacks",
31
"related": "https://yourdomain.commercelayer.io/api/webhooks/xYZkjABcde/last_event_callbacks"
32
}
33
}
34
},
35
"meta": {
36
"mode": "test"
37
}
38
}
39
}
Copied!
Last modified 2mo ago
Copy link