🪝

Posting values via Webhook

Basically, in order to update values on a Pixela graph, you need to request the API with token set in the HTTP header. In most cases this is not a problem, but in some environments or clients such as smart speakers, it may not be possible to set any HTTP headers.
In such environments, you can update the by simply accessing an endpoint if you create a Pixela Webhook endpoint in advance.
 
The first step is creating a webhook with a request like the below:
$ curl -X POST https://pixe.la/v1/users/<username>/webhooks -H 'X-USER-TOKEN:thisissecret' -d '{"graphID":"target-graph-id","type":"increment"}'
{"hashString":"78cea9809ff6aa2fe2b8d26cbdd883b8672c8f3a64b8d273ebd98928d3b01f01","message":"Success.","isSuccess":true}
Shell
By this request, you can create a Webhook (Incoming Webhook) that can increment the value of the date (this Webhook was requested) of the graph whose graph ID is target-graph-id .
 
You need not to set token in the request header when you request this Webhook.
$ curl -X POST https://pixe.la/v1/users/<username>/webhooks/78cea9809ff6aa2fe2b8d26cbdd883b8672c8f3a64b8d273ebd98928d3b01f01 -H 'Content-Length:0'
{"message":"Success.","isSuccess":true}
Shell

Note

  • It is possible to update the value of the graph if hashString is known. Basically, it is better not to disclose this.
  • The contents of the request body for this Webhook endpoint will not be used for anything (it will be ignored).

Related