Pixela API Document

API Document for Pixela ( https://pixe.la/ ) .

POST - /v1/users/<username>/graphs/<graphID>/pixels

Description

This API is used to register multiple Pixels (quantities for a specific day) at a time.

  • This API is for Pixela supporters only.
  • Even if the specified array contains Pixel of the day, Retina of the day is not created.
  • If the specified array contains an invalid Pixel, the registration of other Pixels may partially succeed.

HTTP Method , API endpoint

POST /v1/users/<username>/graphs/<graphID>/pixels

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
- Array[Pixel] [required] Specifies an array of Pixels (See the description below for the definition of the Pixel structure). The maximum number of pixels that can be included in this array at one time is 365..

Pixel

Key Type Description
date string [required] The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.
quantity string [required] Specify the quantity to be registered on the specified date.
Validation rule: int ^\-?[0-9]+, float ^\-?[0-9]+\.[0-9]+
optionalData string [optional] Additional information other than quantity. It is specified as JSON string.
The amount of this data must be less than 10 KB.

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.
  • 402 Payment Required
    • This API is only available to Pixela Supporters, so if you are not a Pixela Supporter, this error will be returned.
  • 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.
  • 413 Payload Too Large
    • This is an error if your request is larger than the limit defined by the Pixela specification. Unless you correct it, the request will not be 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.

Example

$ curl -X POST https://pixe.la/v1/users/a-know/graphs/test-graph/pixels -H 'X-USER-TOKEN:thisissecret' -d '[{"date":"20180914","quantity":"6"},{"date":"20180915","quantity":"5","optionalData":"{\"key\":\"value\"}"},{"date":"20180916","quantity":"4"}]'
{"message":"Success.","isSuccess":true}