Update a Webhook Subscriber
Updates a Webhook Subscriber
PATCH
/
api
/
v2
/
platform
/
webhooks
/
subscribers
/
{id}
Update a Webhook Subscriber
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriber: {
url: 'https://www.url.com/',
active: true,
subscriptions: ['order.created', 'order.completed', 'product.updated']
}
})
};
fetch('http://{defaultHost}/api/v2/platform/webhooks/subscribers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/webhooks/subscribers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriber": {
"url": "https://www.url.com/",
"active": true,
"subscriptions": [
"order.created",
"order.completed",
"product.updated"
]
}
}
'{
"data": {
"id": "12",
"type": "subscriber",
"attributes": {
"url": "https://www.url12.com/",
"active": true,
"subscriptions": [
"*"
],
"created_at": "2022-11-08T19:36:00.130Z",
"updated_at": "2022-11-08T19:36:00.130Z"
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Url must be a valid URL, Url can't be blank, and Url the URL must have a path",
"errors": {
"url": [
"must be a valid URL",
"can't be blank",
"the URL must have a path"
]
}
}Was this page helpful?
⌘I
Update a Webhook Subscriber
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriber: {
url: 'https://www.url.com/',
active: true,
subscriptions: ['order.created', 'order.completed', 'product.updated']
}
})
};
fetch('http://{defaultHost}/api/v2/platform/webhooks/subscribers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url http://{defaultHost}/api/v2/platform/webhooks/subscribers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriber": {
"url": "https://www.url.com/",
"active": true,
"subscriptions": [
"order.created",
"order.completed",
"product.updated"
]
}
}
'{
"data": {
"id": "12",
"type": "subscriber",
"attributes": {
"url": "https://www.url12.com/",
"active": true,
"subscriptions": [
"*"
],
"created_at": "2022-11-08T19:36:00.130Z",
"updated_at": "2022-11-08T19:36:00.130Z"
}
}
}{
"error": "The access token is invalid"
}{
"error": "The resource you were looking for could not be found."
}{
"error": "Url must be a valid URL, Url can't be blank, and Url the URL must have a path",
"errors": {
"url": [
"must be a valid URL",
"can't be blank",
"the URL must have a path"
]
}
}
