API Documentation

Summary

Most requests require authentication; valid forms of authentication are described in Authentication.

Resource

Operation

Description

GET /api_version

Get the api version

Weight

POST /api/v1/weight/record

Log new weight measurement

GET /api/v1/weight/get

Get collection of weight measurements.

Authentication

LifeLogServer.auth.requireAuth(func=None, /, userid_keyword='userid')[source]

In order to authenticated a particular user, you must provide one of that user’s tokens in the ‘token’ header.

Example:

curl --header 'token: 488bf926-f046-4e59-ae62-04431f211fc2' --request GET --url 'https://lifelog.ivanjohnson.net/api/v1/weight/get?since=0&before=2000000000&limit=3000&offset=0'

At present there is no automatic way of obtaining an API token.

API Details

POST /api/v1/weight/record

Add one new weight measurement.

Omitting any query string parameters results in undefined behavior.

Query Parameters
  • datetime – Integer number of seconds since the Unix epoch, representing the time the measurement was made at

  • weight – The recorded weight in kilograms

Status Codes
GET /api/v1/weight/get

Get weight measurements for a given time range.

Results are sorted by date, from oldest to newest. Omitting any query parameter results in undefined behavior.

Query Parameters
  • since – Integer number of seconds since the Unix epoch; return only measurements occuring on or after this time

  • before – Integer number of seconds since the Unix epoch; return only measurements occuring before this time

  • limit – Maximum number of results to return. Behavior is undefined when strictly greater than 100.

  • offset – Instead of returning the start of the sorted list of results, start from this offset.

Response Headers
Returns

csv with one row for each measurement. In order, the columns are: unique id for the measurement, the time of the measurement, and the recorded weight in kilograms.

GET /api_version

Returns the api version of the Life Log Server.

Example Request

curl --request GET --url https://lifelog.ivanjohnson.net/api_version

Example Response

HTTP/1.0 200 OK
Content-Type: text/plain; charset=utf-8

0.4.0a0