/
Sleep

Sleep

GET: https://api.validic.com/v1/organizations/{organization_id}/users/{user_id}/sleep.json

Measurements related to the length of time spent in various sleep cycles and the number​ of times woken during the night.

Sleep URLS

  • GET /v1/organizations/:organization_id/sleep

  • GET /v1/organizations/:organization_id/sleep/latest

  • GET /v1/organizations/:organization_id/users/:user_id/sleep

  • GET /v1/organizations/:organization_id/users/:user_id/sleep/latest

Sleep Short URLS

  • GET /v1/sleep/latest(.:format)

  • GET /v1/sleep(.:format)

Parameters

The following section displays the parameters​ used to retrieve data.

Request

curl --request GET \ --url https://api.validic.com/v1/organizations/organization_id/users/user_id/sleep.json \ --header 'accept: application/json'

Response

{ "summary": { "status": 200, "message": "Ok", "results": 15567, "start_date": "2015-12-01T08:44:29+00:00", "end_date": "2015-12-03T08:54:27+00:00", "offset": 0, "limit": 200, "previous": null, "next": "https://api.validic.com/v1/organizations/5400864SAMPLEd683000004/sleep/latest?access_token=9ff1217aSAMPLE689a3e2fce700de97387920bfaabddc871604a277cb901b2&end_date=2015-12-03T08%3A54%3A27Z&limit=200&page=2&start_date=2015-12-01T08%3A44%3A29Z", "params": { "start_date": "2015-12-01T08:44:29+00:00", "end_date": "2015-12-03T08:54:27+00:00", "offset": 0, "limit": 200 } }, "sleep": [ { "_id": "566002d051842SAMPLE60a28", "awake": 660, "deep": 10740, "last_updated": "2015-12-03T08:52:32+00:00", "light": 0, "rem": 0, "source": "fitbit", "source_name": "Fitbit", "times_woken": 5, "timestamp": "2015-12-02T05:00:00+00:00", "total_sleep": 11400, "user_id": "5548800c68c652SAMPLE003a", "utc_offset": "-05:00", "validated": false }, { "_id": "566002cf518SAMPLE6060a23", "awake": 720, "deep": 42840, "last_updated": "2015-12-03T08:52:31+00:00", "light": 0, "rem": 0, "source": "fitbit", "source_name": "Fitbit", "times_woken": 7, "timestamp": "2015-12-02T05:00:00+00:00", "total_sleep": 43560, "user_id": "5548800c68c65SAMPLE0003a", "utc_offset": "-05:00", "validated": false } ] }

Return Values

The following values are included in a standard response. Expanded data varies by source. You can locate a complete list of expanded fields here.

Return Value

Type

Description

Return Value

Type

Description

timestamp

String

Timestamp for the measurement set

utc_offset

String

Timezone information for the measurement set

source

String

The short name of the application that recorded the activity

source_name

String

The display name of the application that recorded the activity

last_updated

String

Date and time when the measurement set was last updated

_id

String

Unique identifier of the activity (required for POST requests)

awake

Double

The value of the measured quantity in seconds

deep

Double

The value of the measured quantity in seconds

light

Double

The value of the measured quantity in seconds

rem

Double

The value of the measured quantity in seconds

times_woken

Double

The value of the measured quantity

total_sleep

Double

The value of the measured quantity in seconds

validated

Boolean

Value indicates the data you are receiving was generated using a device, opposed to being manually entered by an end user

Additional Examples

Filter by date and expanded

GET https://api.validic.com/v1/organizations/{ORGANIZATION_ID}/users/{USER_ID}/sleep.json?access_token={ORGANIZATION_ACCESS_TOKEN}&start_date=2015-09-01T00:00:00+00:00&end_date=2015-09-30T23:59:59+00:00&expanded=1

Filter by Source

Start Date of Activity

 

Related content

Nutrition
More like this
Fitness
More like this
Accessing Data by Resource Type - Streaming vs REST API
Accessing Data by Resource Type - Streaming vs REST API
More like this