API section
Webhooks
Account webhooks: register alerts, printing and receipt outcomes — to your server, signed with HMAC-SHA256, with retries and a delivery log.
| GET | /api/v1/webhooks | Account webhooks |
| POST | /api/v1/webhooks | Add a webhook |
| POST | /api/v1/webhooks/{id}/test | Test a webhook |
| GET | /api/v1/webhooks/{id}/deliveries | Webhook delivery log |
| DELETE | /api/v1/webhooks/{id} | Delete a webhook |
Account webhooks#
/api/v1/webhooksAddresses the cloud sends account register events to, and how the last delivery went
Response 200 application/json
Array · WebhookView
idinteger int64urlstringeventsarray of stringsecretstringcreatedAtstring date-timelastAtstring date-timelastStatusinteger int32lastErrorstringfailuresinteger int32
Errors — problem+json with a code field, see error codes.
Request example
curl 'https://cloud.hw-connector.ru/api/v1/webhooks' \
-H 'X-Api-Key: hwk_…'Add a webhook#
/api/v1/webhooksEvents: alert.opened, alert.closed (register alerts), device.online, device.offline (a register connected to the cloud; disconnected and did not come back within 10 s), operation.failed (a failed operation on a register), print_job.done, print_job.failed, print_job.cancelled, print_job.expired, print_job.unknown (cloud printing outcomes), receipt.done, receipt.failed, receipt.unknown, receipt.expired (receipt outcomes); the mask print_job.* and * — all. A letter is POST JSON {event, at, …} signed with X-HW-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, "<t>.<body>")>, the letter id — X-HW-Delivery; a 2xx answer means delivered, otherwise up to 10 attempts over ~8 h. The secret is in the response, once. An address in a local network — 400; at most 5 webhooks per account
Request body application/json required
Fields · WebhookRequest
urlstringrequiredfrom 0to 500eventsarray of string
{
"url": "string",
"events": [
"string"
]
}Response 200 application/json
Fields · WebhookView
idinteger int64urlstringeventsarray of stringsecretstringcreatedAtstring date-timelastAtstring date-timelastStatusinteger int32lastErrorstringfailuresinteger int32
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'https://cloud.hw-connector.ru/api/v1/webhooks' \
-H 'X-Api-Key: hwk_…' \
-H 'Content-Type: application/json' \
--data '{"url":"string","events":["string"]}'Test a webhook#
/api/v1/webhooks/{id}/testSend a ping letter {event: "ping"} — check the address and the signature; the outcome is in the delivery log
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer int64 |
Response 200 application/json
Fields · DeliveryView
idinteger int64eventstringattemptsinteger int32statestringlastStatusinteger int32lastErrorstringcreatedAtstring date-timenextAtstring date-timepayloadobject
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'https://cloud.hw-connector.ru/api/v1/webhooks/42/test' \
-H 'X-Api-Key: hwk_…'Webhook delivery log#
/api/v1/webhooks/{id}/deliveriesRecent letters, newest first: event, attempts, state (DELIVERED, RETRYING, FAILED), response status, error and body
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer int64 | |
limit | query | integer int32 |
Response 200 application/json
Array · DeliveryView
idinteger int64eventstringattemptsinteger int32statestringlastStatusinteger int32lastErrorstringcreatedAtstring date-timenextAtstring date-timepayloadobject
Errors — problem+json with a code field, see error codes.
Request example
curl 'https://cloud.hw-connector.ru/api/v1/webhooks/42/deliveries' \
-H 'X-Api-Key: hwk_…'Delete a webhook#
/api/v1/webhooks/{id}Letters not yet delivered are no longer sent
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer int64 |
Response 200
No body.
Errors — problem+json with a code field, see error codes.
Request example
curl -X DELETE 'https://cloud.hw-connector.ru/api/v1/webhooks/42' \
-H 'X-Api-Key: hwk_…'