Creates a new webhook subscription for specified event types.
Responses
-
Subscription successfully created
-
The subscription creation request is not correctly formatted. Subscription not created.
-
Unauthorized - authentication issue.
-
Syntax is correct, but unable to create the given subscription. Subscription not created.
-
Too Many Requests.
-
Internal server error.
POST
/rest/ws/webhooks/v1/subscriptions
curl \
--request POST 'https://ws-eu1.praxedo.com/rest/ws/webhooks/v1/subscriptions' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '[
{
"callback": {
"url": "https://callback.example.com/webhooks",
"secret": "z0nstsmkmrvve4nzc26pu3ky80zsdorlh",
"headers": [
{
"name": "x-pxo-custom_header_name_1",
"value": "value of the custom header 1"
},
{
"name": "x-pxo-custom_header_name_2",
"value": "value of the custom header 2"
}
]
},
"eventTypes": [
{
"name": "workorder.deletion"
}
]
}
]'
Request examples
Subscription request
[
{
"callback": {
"url": "https://callback.example.com/webhooks",
"secret": "z0nstsmkmrvve4nzc26pu3ky80zsdorlh",
"headers": [
{
"name": "x-pxo-custom_header_name_1",
"value": "value of the custom header 1"
},
{
"name": "x-pxo-custom_header_name_2",
"value": "value of the custom header 2"
}
]
},
"eventTypes": [
{
"name": "workorder.deletion"
}
]
}
]
[
{
"callback": {
"url": "https://callback.example.com/webhooks"
},
"eventTypes": [
{
"name": "workorder.deletion"
}
]
}
]
[
{
"callback": {
"url": "https://callback.example.com/webhooks",
"secret": "z0nstsmkmrvve4nzc26pu3ky80zsdorlh"
},
"eventTypes": [
{
"name": "workorder.deletion"
}
]
}
]
Response examples (201)
[
{
"id": "abcdefghijklmnopqrstuvwxyz",
"eventTypes": [
{
"name": "workorder.deletion"
}
]
}
]
Response examples (400)
Missing request body
[
{
"errors": [
{
"code": "subscription.missing.body",
"message": "The request body is mandatory."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.property.missing",
"message": "The callback property is mandatory."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.property.missing",
"message": "The callback.url property is mandatory."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.property.missing",
"message": "The eventTypes property is mandatory."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.eventtypes.size",
"message": "The eventTypes list cannot be empty."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.eventtypes.size",
"message": "The eventTypes list cannot exceed 3 elements."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.eventtypes.invalid",
"message": "The eventType 'DUMMY' is not valid."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.callback.format",
"message": "The format of property callback.url is not valid. It should be a secure url."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.callback.format",
"message": "The property callback.url should not exceed 2000 characters."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.callback.format",
"message": "The property callback.secret should not exceed 512 characters."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.callback.format",
"message": "The property callback.headers.name should not exceed 40 characters."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.callback.format",
"message": "The property callback.headers.value should not exceed 512 characters."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.callback.format",
"message": "The format of property callback.headers.name is invalid. It should be 'x-pxo-{custom_name}'"
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.property.missing",
"message": "The name of property callback.headers.name is missing."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
[
{
"errors": [
{
"code": "subscription.callback.format",
"message": "The property callback.headers has duplicate names."
}
],
"errorReference": "abcdefghijklmnopqrstuvwxyz0123456789"
}
]
Response examples (401)
401 unauthorized
{
"errors": [
{
"code": "unauthorized.nocredentials",
"message": "No credentials."
}
],
"errorReference": "f939c6b8c15045c9a70f500fdb570555"
}
{
"errors": [
{
"code": "unauthorized.badcredentials",
"message": "Bad Credentials."
}
],
"errorReference": "f1028f99811b422eb21f5ff176664069"
}
Response examples (422)
[
{
"errors": [
{
"code": "subscription.max.size",
"message": "Maximum of subscription reached."
}
],
"errorReference": "f1028f99811b422eb21f5ff176664069"
}
]
Response examples (429)
{
"errors": [
{
"code": "ratelimiter.toomanyrequest",
"message": "Rejected because of the rate limit definition."
}
],
"errorReference": "973326230a3f44daba6cc34a5939b4fb"
}
Response examples (500)
{
"errors": [
{
"code": "internal.server.error",
"message": "Something went wrong."
}
],
"errorReference": "6377010431314bf6b0b95ec4d32ddae0"
}