Medications

This endpoint focuses on retrieving user medication intake records. It supports filtering by specific medication ID, startDate, and includes pagination capabilities to manage large data sets effectively.

Properties

  • Name
    user_id
    Type
    string
    Description

    UUID of the user. This must be a valid UUID that represents the user whose medication intake data is being requested.


GET/api/v1/medications/[user_id]

Get Medication Intake Data

This endpoint allows you to retrieve medication intake data for a specified user. By default, it returns data sorted in descending order.

Optional attributes

  • Name
    startDate
    Type
    string
    Description

    The start date to filter the medication data. Must be in ISO 8601 format. Defaults to the earliest record if not provided.

  • Name
    medicationID
    Type
    string
    Description

    The ID of the medication to filter by. If not provided, data for all medications are returned.

  • Name
    sort
    Type
    string
    Description

    Specifies the sort order of the data, either asc for ascending or desc for descending. Defaults to descending if not provided.

  • Name
    page
    Type
    integer
    Description

    The page number of results to return. Must be an integer greater than 0. Defaults to 1.

  • Name
    pageSize
    Type
    integer
    Description

    The number of results per page. Must be an integer between 1 and 10,000. Defaults to 1,000.

Request

GET
/api/v1/medications/[user_id]
curl -G "https://api.onetwentyone.ai/api/v1/medications/123e4567-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer {token}" \
  -d startDate="2022-01-01" \
  -d medicationID="2e49c0c7-eb90-4d5c-8d86-5b6bee1e352c" \
  -d sort="asc" \
  -d page=1 \
  -d pageSize=3

Response

{
  "pagination": {
    "current_page": 1,
    "has_more": false,
    "next_page": null,
    "prev_page": null
  },
  "limit": {
    "X-RateLimit-Limit": 10000,
    "X-RateLimit-Remaining": 9989,
    "X-RateLimit-Reset": 1717286400
  },
  "data": [
    {
      "id": "2e49c0c7-eb90-4d5c-8d86-5b6bee1e352c",
      "details": {
        "name": "TADALAFIL",
        "active_ingredient": "TADALAFIL"
      },
      "logs": [
        {
          "id": "971e5bb6-d733-4b47-9dc6-c0e7347c0dd9",
          "created_at": "2022-05-26T06:18:46.21423+00:00",
          "user_id": "123e4567-e89b-12d3-a456-426614174000",
          "medication_id": "2e49c0c7-eb90-4d5c-8d86-5b6bee1e352c",
          "quantity": 2.5,
          "unit": "mg"
        }
      ]
    }
  ]
}

Was this page helpful?