Create a webhook endpoint
curl --request POST \
--url https://api.printeasy.adfinite.com/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
"printjob.done",
"printjob.error"
],
"url": "https://example.com/printeasy/webhooks"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: ['printjob.done', 'printjob.error'],
url: 'https://example.com/printeasy/webhooks'
})
};
fetch('https://api.printeasy.adfinite.com/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.printeasy.adfinite.com/v1/webhooks"
payload = {
"events": ["printjob.done", "printjob.error"],
"url": "https://example.com/printeasy/webhooks"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"createdAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"disabledReason": "<string>",
"enabled": true,
"events": [
"printjob.done"
],
"failingSince": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mode": "live",
"url": "https://example.com/printeasy/webhooks",
"secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD"
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}Webhooks
Create a webhook endpoint
Creates an endpoint in the mode of the calling key. The response holds the signing secret; store it now, it is never shown again. Live endpoints need https and every URL must resolve to a public address.
POST
/
v1
/
webhooks
Create a webhook endpoint
curl --request POST \
--url https://api.printeasy.adfinite.com/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
"printjob.done",
"printjob.error"
],
"url": "https://example.com/printeasy/webhooks"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: ['printjob.done', 'printjob.error'],
url: 'https://example.com/printeasy/webhooks'
})
};
fetch('https://api.printeasy.adfinite.com/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.printeasy.adfinite.com/v1/webhooks"
payload = {
"events": ["printjob.done", "printjob.error"],
"url": "https://example.com/printeasy/webhooks"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"createdAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"disabledReason": "<string>",
"enabled": true,
"events": [
"printjob.done"
],
"failingSince": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mode": "live",
"url": "https://example.com/printeasy/webhooks",
"secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD"
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}{
"error": {
"code": "not_found",
"message": "Printer not found",
"request_id": "4f9c2a7e-1b3d-4c5e-8f6a-0b1c2d3e4f5a"
}
}Authorizations
ApiKeyAuthBasicAuth
Send Authorization: Bearer <API key>. Use a pe_test_ key in the playground; it only reaches virtual test printers.
Body
application/json
Endpoint to create
Minimum array length:
1Available options:
printjob.queued, printjob.sent, printjob.received, printjob.printing, printjob.done, printjob.error, printjob.cancelled, printjob.expired, computer.online, computer.offline, printer.added, printer.removed, printer.online, printer.offline, printer.updated Example:
["printjob.done", "printjob.error"]
Maximum string length:
2048Example:
"https://example.com/printeasy/webhooks"
Maximum string length:
256Example:
"ERP print status"
Response
The new endpoint with its secret
Why the endpoint is disabled: by a user, or automatically after 5 days of failures
Available options:
printjob.queued, printjob.sent, printjob.received, printjob.printing, printjob.done, printjob.error, printjob.cancelled, printjob.expired, computer.online, computer.offline, printer.added, printer.removed, printer.online, printer.offline, printer.updated Start of the current run of failed deliveries; null while healthy
Available options:
live, test Example:
"https://example.com/printeasy/webhooks"
Signing secret, returned only by this response. Store it now.
Example:
"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD"
Was this page helpful?