Pixela API Document

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

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

Description

This will start and end the measurement of the time.

The first request indicates the start of the measurement, the second request indicates the end of the measurement. When a request for end-of-measurement is made, the time (in minutes) measured is recorded on the graph as the date of the day.

The time (in minutes) recorded will be rounded to an integer if the graph type is int. In addition, it is not possible to measure time across days.

Help page

Instant recording - Pixela Help Center

HTTP Method , API endpoint

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

Request Header

Key Description
X-USER-TOKEN [required] 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.

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 POST https://pixe.la/v1/users/a-know/graphs/stopwatch-test/stopwatch -H 'X-USER-TOKEN:thisissecret' -H 'Content-Length:0'
{"message":"Stopwatch start successful.","isSuccess":true}

(...)

$ curl -X POST https://pixe.la/v1/users/a-know/graphs/stopwatch-test/stopwatch -H 'X-USER-TOKEN:thisissecret' -H 'Content-Length:0'
{"message":"Stopwatch stop successful. This time duration is 1m53.009979867s . Pixel updated, too. Quantity=4.56 (2.68 + 1.88)","isSuccess":true}
$ curl -X GET https://pixe.la/v1/users/a-know/graphs/stopwatch-test/20200504 -H 'X-USER-TOKEN:thisissecret'
{"quantity":"4.56","optionalData":"{\"stopwatchUsage\":{\"stopwatchUseCount\":2,\"stopwatchPeriods\":[\"20:00:00 - 20:02:40\",\"21:00:00 - 21:01:53\"]}}"}