API Reference

Sleep Goals

48 views 0

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
}' 

Was this helpful?

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close