Pixela Logo

Pixela - Pixelation API Service

"Pixel" is â–  â–  â–  â–  â–  ! / Record, and Visualize.


Getting Started

Pixela is easy to start with 3 steps.

1. Create a user.

$ curl -X POST https://pixe.la/v1/users -d '{"token":"thisissecret", "username":"a-know", "agreeTermsOfService":"yes", "notMinor":"yes"}'
{"message":"Success.","isSuccess":true}

2. Create a graph definition.

$ 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"}'
{"message":"Success.","isSuccess":true}

3. Get the graph!

Browse https://pixe.la/v1/users/a-know/graphs/test-graph !

Getting Started

4. If you want to record quantity, ...

$ curl -X POST https://pixe.la/v1/users/a-know/graphs/test-graph -H 'X-USER-TOKEN:thisissecret' -d '{"date":"20180915","quantity":"5"}'
{"message":"Success.","isSuccess":true}

5. Browse again!

Browse https://pixe.la/v1/users/a-know/graphs/test-graph, again!

Getting Started

6. That's all! Please see here for more useful usage!


About

Lorem Ipsum"Pixela" is the Pixelation API service. With this service, you can get a graph that expresses the degree of your daily various activities on a basis with a vivid gradation. Registration / deletion of user and graph definition, degree of activity etc. can all be done via API, so it can be used programmably.


API Reference - User

This is an API for performing operations on users on Pixela. Authentication is performed by specifying a token in X-USER-TOKEN in the HTTP request header.

POST /v1/users

Create a new Pixela user.

Request Body
Key Type Description
token string [not optional] A token string used to authenticate as a user to be created. The token string is hashed and saved.
Validation rule: [ -~]{8,128}
username string [not optional] User name for this service. Validation rule: [a-z][a-z0-9-]{1,16}
agreeTermsOfService string [not optional] Specify yes or no whether you agree to the terms of service.
Please see: Terms of service - Japanese version / Terms of service - English version
notMinor string [not optional] Specify yes or no as to whether you are not a minor or if you are a minor and you have the parental consent of using this service.
Example
$ curl -X POST https://pixe.la/v1/users -d '{"token":"thisissecret", "username":"a-know", "agreeTermsOfService":"yes", "notMinor":"yes"}'
{"message":"Success.","isSuccess":true}

PUT /v1/users/<username>

Updates the authentication token for the specified user.

Request Body
Key Type Description
newToken string [not optional] It is a new authentication token. The token string is hashed and saved. Validation rule: [ -~]{8,128}
Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X PUT https://pixe.la/v1/users/a-know -H 'X-USER-TOKEN:thisissecret' -d '{"newToken":"thisissecret"}'
{"message":"Success.","isSuccess":true}

DELETE /v1/users/<username>

Deletes the specified registered user.

Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X DELETE https://pixe.la/v1/users/a-know -H 'X-USER-TOKEN:thisissecret'
{"message":"Success.","isSuccess":true}

API Reference - Graph

This is an API for creating, acquiring, updating and deleting pixleation graph definitions. Authentication is performed by specifying a token in X-USER-TOKEN in the HTTP request header.

POST /v1/users/<username>/graphs

Create a new pixelation graph definition.

Request Body
Key Type Description
id string [not optional] It is an ID for identifying the pixelation graph.
Validation rule: ^[a-z][a-z0-9-]{1,16}
name string [not optional] It is the name of the pixelation graph.
unit string [not optional] It is a unit of the quantity recorded in the pixelation graph. Ex. commit, kilogram, calory.
type string [not optional] It is the type of quantity to be handled in the graph. Only int or float are supported.
color string [not optional] Defines the display color of the pixel in the pixelation graph. shibafu, momiji, sora, ichou, ajisai and kuro are supported as color kind.
Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
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"}'
{"message":"Success.","isSuccess":true}

GET /v1/users/<username>/graphs

Get all predefined pixelation graph definitions.

Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X GET https://pixe.la/v1/users/a-know/graphs -H 'X-USER-TOKEN:thisissecret'
{"graphs":[{"id":"test-graph","name":"graph-name","unit":"commit","type":"int","color":"shibafu"}]}

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

Based on the registered information, express the graph in SVG format diagram.

Query Parameter
Key Description
date string [optional] If you specify it in yyyyMMdd format, will create a pixelation graph dating back to the past with that day as the start date. If this parameter is not specified, the current date (UTC) and time will be the start date.
Example
$ curl -X GET https://pixe.la/v1/users/a-know/graphs/test-graph?date=20180331
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="135">
...
</svg>

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

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

Request Body
Key Type Description
name string [not optional] It is the name of the pixelation graph.
unit string [not optional] It is a unit of the quantity recorded in the pixelation graph. Ex. commit, kilogram, calory.
color string [not optional] Defines the display color of the pixel in the pixelation graph. shibafu, momiji, sora, ichou, ajisai and kuro are supported as color kind.
Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
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"}'
{"message":"Success.","isSuccess":true}

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

Delete the predefined pixelation graph definition.

Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X DELETE https://pixe.la/v1/users/a-know/graphs/test-graph -H 'X-USER-TOKEN:thisissecret'
{"message":"Success.","isSuccess":true}

API Reference - Pixel

"Pixel" is data representing the quantity of each day. This is an API for creating, acquiring, updating and deleting Pixel in specified pixelation graph. Authentication is performed by specifying a token in X-USER-TOKEN in the HTTP request header.

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

It records the quantity of the specified date as a "Pixel".

Request Body
Key Type Description
date string [not optional] The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.
quantity string [not optional] Specify the quantity to be registered on the specified date.
Validation rule: int^\-?[0-9]+ float^\-?[0-9]+\.[0-9]+
Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X POST https://pixe.la/v1/users/a-know/graphs/test-graph -H 'X-USER-TOKEN:thisissecret' -d '{"date":"20180915","quantity":"5"}'
{"message":"Success.","isSuccess":true}

GET /v1/users/<username>/graphs/<graphID>/<yyyyMMdd>

Get registered quantity as "Pixel".

Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X GET https://pixe.la/v1/users/a-know/graphs/test-graph/20180915 -H 'X-USER-TOKEN:thisissecret'
{"quantity":5}

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

Update the quantity already registered as a "Pixel".

Request Body
Key Type Description
name string [not optional] It is the name of the pixelation graph.
quantity string [not optional] Specify the quantity to be registered on the specified date.
Validation rule: ^\-?[0-9]+\.?[0-9]+
Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X PUT https://pixe.la/v1/users/a-know/graphs/test-graph/20180915 -H 'X-USER-TOKEN:thisissecret' -d '{"quantity":"7"}'
{"message":"Success.","isSuccess":true}

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

Increment quantity "Pixel" of the day (UTC).
If the graph type is int then 1 added, and for float then 0.01 added.

Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Content-Length Since the request body is not specified, specify the Content-Length header.
Example
$ curl -X PUT https://pixe.la/v1/users/a-know/graphs/test-graph/increment -H 'X-USER-TOKEN:thisissecret' -H 'Content-Length:0'
{"message":"Success.","isSuccess":true}

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

Decrement quantity "Pixel" of the day (UTC).
If the graph type is int then -1 added, and for float then -0.01 added.

Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Content-Length Since the request body is not specified, specify the Content-Length header.
Example
$ curl -X PUT https://pixe.la/v1/users/a-know/graphs/test-graph/decrement -H 'X-USER-TOKEN:thisissecret' -H 'Content-Length:0'
{"message":"Success.","isSuccess":true}

DELETE /v1/users/<username>/graphs/<graphID>/<yyyyMMdd>

Delete the registered "Pixel".

Request Header
Key Description
X-USER-TOKEN [not optional] It is the authentication token specified at the time of user registration.
Example
$ curl -X DELETE https://pixe.la/v1/users/a-know/graphs/test-graph/20180915 -H 'X-USER-TOKEN:thisissecret'
{"message":"Success.","isSuccess":true}

Useful Usage

Here are some useful ways to use Pixela. Please try incorporating Pixela in your daily life in various ways.

ex.1 Record from iOS 12 "Shortcut"

iOS 12 "Shortcut" is a convenient function that can also send any HTTP requests.
Create shortcuts like below for registering quantity to Pixela in advance. How about using the shortcut at the end of the day to record the quantity of your day?

(Click to view large image)


iOS 12 "Shortcut" can also access "Healthcare" metrics such as step count and mileage.
Let's make various shortcuts!


ex.2 Incorporate /increment API calls into your CI / CD flow

With Pixela /increment API, you can add quantity more and more.
By incorporating this /increment API call into your CI / CD flow, you can easily get pixelation graph and appeal the state of the number of deployments per day.
The pixelation graph below shows an example when you record the number of deployments.


And more...

Please come up with your own way of using interesting and useful Pixela! And please tell me @a_know that!