Quantity

The route that allows you to retrieve quantitative health metrics such as exercise time or VO2 levels. Users can specify metrics, sort orders, and date ranges, making this endpoint highly customizable.

Properties

  • Name
    user_id
    Type
    string
    Description

    UUID of the user. Must be in a valid UUID format.

  • Name
    metric
    Type
    string
    Description

    Specific type of metric requested. Must be within the allowed list of allowed metrics.


GET/api/v1/quantity/{user_id}/{metric}

List metric's values

This endpoint allows you to retrieve a list of a specific metrics values. By default, a maximum of 1000 values are shown per page and values are sorted in descending order.

Optional attributes

  • Name
    startDate
    Type
    string
    Description

    Start date for filtering the dataset. Must be in ISO 8601 format. If not defined, data retrieval starts from the earliest record.

  • Name
    endDate
    Type
    string
    Description

    End date for filtering the dataset. Must be in ISO 8601 format. If not defined, data retrieval goes up to the latest record.

  • Name
    sort
    Type
    string
    Description

    Defines the sorting order of the results, can be asc for ascending or desc for descending. Defaults to descending if not specified.

  • Name
    page
    Type
    int
    Description

    The page number of the results to return. Defaults to 1 if not specified.

  • Name
    pageSize
    Type
    int
    Description

    The number of records to return per page. Defaults to 10000, with a maximum limit of 10,000.

Request

GET
/api/v1/quantity/{user_id}/{metric}
curl -G https://api.onetwentyone.ai/api/v1/quantity/123e4567-e89b-12d3-a456-426614174000/appleExerciseTime \
-H "Authorization: Bearer {token}" \
-d startDate="2022-01-01" \
-d endDate="2022-01-31" \
-d sort="asc" \
-d page=1 \
-d pageSize=50

Response

{
  "pagination": {
    "current_page": 1,
    "has_more": true,
    "next_page": "/api/v1/quantity/123e4567-e89b-12d3-a456-426614174000/appleExerciseTime?startDate=2022-01-01&endDate=2022-01-31&page=2&pageSize=50",
    "prev_page": null
  },
  "limit": {
    "X-RateLimit-Limit": 10000,
    "X-RateLimit-Remaining": 9992,
    "X-RateLimit-Reset": 1715126400
},
  "data": [
    {
      "start": "2022-01-01T00:00:00Z",
      "end": "2022-01-01T01:02:00Z",
      "value": 62,
      "timezone": "America/New_York",
      "log_method": "WATCH"
    }
    // More items...
  ]

}

Was this page helpful?