Description
Create a new pixelation graph definition.
Help page
HTTP Method , API endpoint
POST /v1/users/<username>/graphs
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 |
---|---|---|
id | string | [required] It is an ID for identifying the pixelation graph. Validation rule: ^[a-z][a-z0-9-]{1,16} |
name | string | [required] It is the name of the pixelation graph. |
unit | string | [required] It is a unit of the quantity recorded in the pixelation graph. Ex. commit, kilogram, calory. |
type | string | [required] It is the type of quantity to be handled in the graph. Only int or float are supported. |
color | string | [required] 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 . |
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.
409 Conflict
- This error occurs when your request conflicts with something else. Check the message in the response body, and review or retry the request.
500 Internal Server Error
- Status in the event of an unexpected error. Retrying the request may be successfully processed.
Example
$ curl -X POST https://pixe.la/v1/users/a-know/graphs -H 'X-USER-TOKEN:thisissecret' -d '{"id":"test-graph","name":"graph-name","unit":"commit","type":"int","color":"shibafu","timezone":"Asia/Tokyo","isSecret":true,"publishOptionalData":true}' {"message":"Success.","isSuccess":true}