GET child logs - ocariot/api-gateway GitHub Wiki

Description

Retrieves logs with information on the total steps, calories, active_minutes, lightly_active_minutes and sedentary_minutes of a Child in a given period.

The sedentary_minutes are calculated by movement, and you need to be inactive for 10 consecutive minutes before the period is considered stationary. The lightly_active_minutes field represents minutes of light activites. The active_minutes represent field represents minutes of fairly active and very active activities.

Permissions:

  • Admin and Application users can list all logs for any Child.

  • A child can list all his logs.

  • An Educator as well as a Health Professional can list all Child logs as long as the Child belongs to one of their groups.

  • A Family user can list all logs of any Child associated with them.

Scope

physicalactivities:read

URL

GET https://localhost/v1/children/{child_id}/logs/date/{date_start}/{date_end}

Parameters

child_id: string (A 24-byte hex ID)

date_start: string The start date of range.

date_end: string The end date of range.

Curl example

curl -X GET "https://localhost/v1/children/5a62be07d6f33400146c9b61/logs/date/2019-11-20/2019-11-25" -H "accept: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response body

  • 200 Successful requisition.

    {
      "steps": [
        {
          "date": "2019-04-23",
          "value": 1400
        },
        {
          "date": "2019-04-24",
          "value": 1587
        }
      ],
      "calories": [
        {
          "date": "2019-04-23",
          "value": 1500
        },
        {
          "date": "2019-04-24",
          "value": 1859
        }
      ],
      "active_minutes": [
        {
          "date": "2019-04-23",
          "value": 48
        },
        {
          "date": "2019-04-24",
          "value": 57
        }
      ],
      "lightly_active_minutes": [
        {
          "date": "2019-04-23",
          "value": 35
        },
        {
          "date": "2019-04-24",
          "value": 44
        }
      ],
      "sedentary_minutes": [
        {
          "date": "2019-04-23",
          "value": 105
        },
        {
          "date": "2019-04-24",
          "value": 96
        }
      ]
    }
    
  • 400 Validation errors

    • Invalid child id

    • Child does not exist

    • Invalid date

      • Example
        {
          "code": 400,
          "message": "Date parameter: {datetime}, is not in valid ISO 8601 format.",
          "description": "Date must be in the format: yyyy-MM-dd"
        }
        
    • Invalid date range

      • Example
        {
          "code": 400,
          "message": "Date range is invalid...",
          "description": "The date_end parameter can not contain an older date than that the date_start parameter!" || "The period between the received dates can not exceed one year!"
        }
        
  • 401 Unauthorized Error

  • 403 Permission Error

  • 429 Too Many Requests Error

  • 500 Internal Server Error