Description
Create a new Webhook.
Help page
HTTP Method , API endpoint
POST /v1/users/<username>/webhooks
Request Header
Key | Description |
---|---|
X-USER-TOKEN | [required] It is the authentication token specified at the time of user registration. |
Request Body
Key | Type | Description |
---|---|---|
graphID | string | [required] Specify the target graph as an ID. |
type | string | [required] Specify the behavior when this Webhook is invoked. You can specify one of increment decrement add subtract stopwatch . |
quantity | string | [optional] Specify the value you want to add or subtract when a webhook of type add or subtract is invoked. If this value is not specified, 1 or 0.01 is used as the value to add or subtract. Even if a value is set for this property in the case of an increment decrement or stopwatch type webhook, it will not be used. |
Possible errors by HTTP response status code
400 Bad Request
- This is an error if there is some mistake in your request. Unless the mistake is corrected, the request will not succeed.
404 Not Found
- This error occurs when your request destination does not exist.
- This error also occurs when authentication to the request destination is not successful.
500 Internal Server Error
- Status in the event of an unexpected error. Retrying the request may be successfully processed.
503 Service Unavailable
- This error occurs when Pixela is temporarily unavailable. Please take a moment and retry your request.
- If the response body contains
"isRejected":true
, it indicates that the request was rejected 25% of the time. In this case, the request can be retried until it succeeds.- You can avoid this rejection by becoming a Pixela supporter. See this page for more information.
Example
$ curl -X POST https://pixe.la/v1/users/a-know/webhooks -H 'X-USER-TOKEN:thisissecret' -d '{"graphID":"test-graph","type":"increment"}' {"webhookHash":"<WebhookHashString>","message":"Success.","isSuccess":true} $ curl -X POST https://pixe.la/v1/users/a-know/webhooks -H 'X-USER-TOKEN:thisissecret' -d '{"graphID":"test-graph","type":"subtract","quantity":"5"}' {"webhookHash":"<WebhookHashString>","message":"Success.","isSuccess":true}