GET child sleep by ID - ocariot/api-gateway GitHub Wiki
Description
Retrieves a sleep data associated with a Child.
Permission:
-
Admin and Application users can list any Sleep of any Child.
-
A Child can list any Sleep as long as it is yours.
-
An Educator as well as a Health Professional can list any Sleep of any Child as long as the Child belongs to one of their groups.
-
A Family user can list any Sleep of any Child associated with it.
Scope
sleep:read
URL
GET https://localhost/v1/children/{child_id}/sleep/{sleep_id}
Parameters
child_id: string (A 24-byte hex ID)
sleep_id: string (A 24-byte hex ID)
Curl example
curl -X GET "https://localhost/v1/children/5a62be07d6f33400146c9b61/sleep/3bc1274329fb282470e45004" -H "accept: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response body
-
200
Successful requisition.{ "id": "3bc1274329fb282470e45004", "start_time": "2019-08-18T01:40:30Z", "end_time": "2019-08-18T09:52:30Z", "duration": 29520000, "type": "classic", "pattern": { "data_set": [ { "start_time": "2019-08-18T01:40:30.00Z", "name": "restless", "duration": 60000 }, { "start_time": "2019-08-18T01:41:30.00Z", "name": "asleep", "duration": 360000 }, { "start_time": "2019-08-18T01:47:30.00Z", "name": "restless", "duration": 240000 }, { "start_time": "2019-08-18T01:51:30.00Z", "name": "asleep", "duration": 60000 }, { "start_time": "2019-08-18T02:32:30.00Z", "name": "awake", "duration": 180000 }, { "start_time": "2019-08-18T06:47:30.00Z", "name": "restless", "duration": 60000 }, { "start_time": "2019-08-18T06:48:30.00Z", "name": "asleep", "duration": 2580000 }, { "start_time": "2019-08-18T07:31:30.00Z", "name": "restless", "duration": 120000 }, { "start_time": "2019-08-18T09:36:30.00Z", "name": "asleep", "duration": 960000 } ], "summary": { "asleep": { "count": 4, "duration": 3960000 }, "awake": { "count": 1, "duration": 180000 }, "restless": { "count": 4, "duration": 480000 } } }, "child_id": "5a62be07de34500146d9c544" }
-
400
Validation errors -
403
Permission Error -
404
Not Found Error