Pixela API Document

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

PUT - /v1/users/<username>/graphs/<graphID>

Description

Update predefined pixelation graph definitions.
The items that can be updated are limited as compared with the pixelation graph definition creation.

Help page

Graph - Pixela Help Center

HTTP Method , API endpoint

PUT /v1/users/<username>/graphs/<graphID>

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
name string [optional] It is the name of the pixelation graph.
unit string [optional] It is a unit of the quantity recorded in the pixelation graph. Ex. commit, kilogram, calory.
color string [optional] Defines the display color of the pixel in the pixelation graph.
shibafu (green), momiji (red), sora (blue), ichou (yellow), ajisai (purple) and kuro (black) are supported as color kind.
timezone string [optional] Specify the time zone for this graph as TZ database name (not Time zone abbreviation). If not specified, it is treated as UTC.
purgeCacheURLs array[string] [optional] This is an advanced option.
Specify the URL to send the purge request to purge the cache when the graph is updated.
For example, in GitHub, since all images referenced from GitHub are cached, it is necessary to purge the cache every time the Pixeleation graph is changed.
Even with the same Pixelation graph, different cache URLs are generated when referring from multiple places, you can specify up to 5 URLs.
Please see also Embedding Pixela graphs in GitHub
selfSufficient string [optional] If SVG graph with this field increment or decrement is referenced, Pixel of this graph itself will be incremented or decremented.
It is suitable when you want to record the PVs on a web page or site simultaneously.
The specification of increment or decrement is the same as Increment a Pixel and Decrement a Pixel with webhook.
If not specified, it is treated as none .
This feature is limited for Pixela Supporter. About Pixela Supporter , please check How to support Pixela by Patreon / Use Limited Features.
isSecret bool [optional] Graphs with this property's value true are not displayed on the graph list page and can be kept secret.
However, this feature is a limited to supporters. For details, please check How to support Pixela by Patreon / Use Limited Features.
publishOptionalData bool [optional] If this property is true, each pixel's optionalData will be added to the generated SVG data as a data-optional attribute.
This feature is limited for Pixela Supporter. About Pixela Supporter , please check How to support Pixela by Patreon / Use Limited Features.

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.

Example

$ curl -X PUT https://pixe.la/v1/users/a-know/graphs/test-graph -H 'X-USER-TOKEN:thisissecret' -d '{"name":"graph-name","unit":"commit","color":"shibafu","timezone":"Asia/Tokyo","purgeCacheURLs":["https://camo.githubusercontent.com/xxx/xxxx"],"publishOptionalData":true}'
{"message":"Success.","isSuccess":true}