Pixela API Document

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

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

Description

Create a notification rule.
You must be a Pixela supporter to create multiple notifications. see: How to support Pixela by Patreon / Use Limited Features · a-know/Pixela Wiki · GitHub

HTTP Method , API endpoint

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

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 notification settings.
Validation rule: ^[a-z][a-z0-9-]{1,16}
name string [required] It is the name of the notification settings.
target string [required] Specify the target to be notified.
Only quantity is supported.
condition string [required] Specify the condition used to judge whether to notify or not.
>, =, <, and multipleOf are available.
You must be a Pixela supporter to specify multipleOf condition. see: How to support Pixela by Patreon / Use Limited Features · a-know/Pixela Wiki · GitHub
threshold string [required] Specify the threshold value for deciding whether to notify or not. The number must match the graph type(int or float).
remindBy string [optional]
The number from 0 to 23 is specified as a string. This represents the time of day. If a number is specified for this property, the following operations will be performed automatically every day at the time of the number of this property.

- Check the quantity of pixel for that day on the graph from which this notification is related.
- If the check result does not satisfy the conditions ( condition , threshold ) of this notification rule, a notification will be sent.

The time zone set in the graph is used to perform this process. You can also set this item to an empty strings ("") if you don't want this process.
channelID string [required] Specify the ID of the channel to be notified.

Example

$ curl -X POST https://pixe.la/v1/users/a-know/graphs/test-graph/notifications -H 'X-USER-TOKEN:thisissecret' -d '{"id":"my-notification-rule","name":"my notification rule","target":"quantity","condition":">","threshold":"5","remindBy":"21","channelID":"my-channel"}'
{"message":"Success.","isSuccess":true}