Sleep Goals
A Sleep Goal can be used to set a personal user goal for sleep.
Overview
Property | Type | Description |
---|---|---|
code | String | The id of the sleep measurement |
user_code | String | The global Id of the user |
start_time | Datetime with Timezone | The original start date and time of the sleep segment in UTC time |
min_duration | Number | The target sleep duration in minutes |
source | String | The source service for the measurement, where it was created |
created_at | Datetime with Timezone | The time the measurement was created on the ZivaCare API server |
updated_at | Datetime with Timezone | The time the measurement was updated on the ZivaCare API server |
Example
GET https://api.zivacare.com/api/v2/human/sleep_goals?access_token=demo
{
"sleepGoals": [
{
"code": "e502152d-8ee8-47cd-87ef-afeb2638e3b3",
"user_code": "e231e984-2209-4a10-b634-2257b89c200f",
"start_time": "2014-09-16 15:52:01+00",
"min_duration": 90.00,
"source": "fitbit",
"created_at": "2016-06-02 07:48:14+00",
"updated_at": "2016-06-02 07:48:47+00"
}
],
"total": 1
}
curl -i POST -H 'Content-Type: application/json' https://api.zivacare.com/api/v2/human/sleep_goals?access_token=demo -d '{
"source": "fitbit",
"start_time": "2014-09-16T15:52:01+0000"
}'
curl -i PUT -H 'Content-Type: application/json' https://api.zivacare.com/api/v2/human/sleep_goals/e502152d-8ee8-47cd-87ef-afeb2638e3b3?access_token=demo -d '{
"source": "fitbit",
"start_time": "2014-09-16T15:52:01+0000",
"min_duration": 90.00
}'