HTTP Header

headers = {
    "USER-X-TOKEN": TOKEN,
}

response = requests.post(url=graph_endpoint, json=graph_config, headers=headers)

Step2. Create a graph definition

Call /v1/users/<username>/graphs by HTTP POST.

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.

Step3. Get the graph!

Browse https://pixe.la/v1/users/a-know/graphs/test-graph ! This is also /v1/users/<username>/graphs/<graphID> API.

#為什麼要加 .html?