Make your product
work with UP.

Trends

Returns the user's trends over a period of time (e.g. 5 weeks), using the given granularity (e.g. by day).

Trends data returned is controlled by the scopes meal_read, sleep_read, and move_read. The returned result will be filtered based on the scope that user token has for your application. For example if your token only has the scope sleep_read then only the sleep trends data will be returned. If the token has all three scopes then the complete trends data set will be returned.
URI Method Response Type Returns
/nudge/api/users/@me/trends GET application/json Collection>Trends
Parameter Type Description
end_date int Date, formatted as YYYYMMDD. If omitted will default to today.
bucket_size string Determines the granularity to use when aggregating the values. Possible values are: d (for days), w (for weeks), m (for months), y (for years). If omitted will default to days.
range string Possible values are: d (for days), w (for weeks), m (for months), y (for years). If omitted will default to days.
range_duration int How many ranges to go back, starting at the given end_date and going backwards in time. Maximum is 100.

Example:

GET https://jawbone.com/nudge/api/v.1.0/users/@me/trends?range_duration=5&range=w&bucket_size=d HTTP/1.1
Host: jawbone.com
	

Will return:

HTTP 200 OK
{
   “meta”:
   {
      “user_xid”: “6xl39CsoVp2KirfHwVq_Fx”,
      “message”: “OK”,
      “code”: 200,
      "time": 1386711801
   },
   “data”:
   {    
      "earliest": 20120525,
      "data": 
      [[
         20131105, 
         {
            "weight": 94.6            
            "height": 1.8034
            "gender": false
            "age": 29.5835616438
            "bmr": 2002.0974546
            "body_fat": 25
            "m_steps": 2184
            "m_calories": 129.136649132
            "m_total_calories": 2131.23410373
            "m_active_time": 1093
            "m_workout_time": 0
            "m_distance": 1795
            "e_calories": 530
            "e_carbs": 64.75
            "e_cholesterol": 50
            "e_protein": 16.77
            "e_calcium": 140
            "e_unsat_fat": 15.313
            "e_sat_fat": 6
            "e_sodium": 504
            "e_sugar": 19
            "e_fiber": 0
            "s_bedtime": -370
            "s_asleep_time": 298
            "s_awake": 1820
            "s_awake_time": 24530
            "s_awakenings": 2
            "s_light": 9828
            "s_deep": 13252
            "s_duration": 23080
            "s_quality": 69
            "n_bedtime": null
            "n_asleep_time": null
            "n_awake": null
            "n_awake_time": null
            "n_awakenings": null
            "n_light": null
            "n_deep": null
            "n_duration": null
            "n_quality": null
         }   
      ],[
         ... more data ...
      ]],      
      "links": 
      {
         "next": "/nudge/api/v.1.0/users/6xl39CsoVp2KirfHwVq_Fx/trends/?end_date=20131104&range=w&range_duration=5&bucket_size=d"
      }
   }
}
	
Data Value Type Description
earliest int First date there is data for this user, in YYYYMMDD format.
weight int Weight of the user, in kilograms.
gender boolean Gender of user. True = female, False = Male. NOTE: There is a current bug in the API where this value is returning as NULL. Workaround is to use user call at top above to retrieve gender.
age int Age of user
bmr int Basal metabolic rate per day.
body_fat int Body fat percentage of user.
m_steps int Number of steps taken.
m_calories int Number of calories burned directly from activity.
m_total_calories int Total number of calories burned including bmr.
m_active_time int Total active time.
m_workout_time int Workout time.
m_distance int Total distance travelled, in meters.
e_calories int Calories consumed.
e_carbs int Total carbs consumed (in grams).
e_cholesterol int Total cholesterol consumed (in milligrams).
e_protein int Total protein consumed (in grams).
e_calcium int Total calcium consumed (in milligrams).
e_unsat_fat int Total unsaturated fat (in grams).
e_sat_fat int Total saturated fat (in grams).
e_sodium int Total amount of sodium (in milligrams).
e_sugar int Total amount of sugar (in grams).
e_fiber int Total amount of fiber (in grams)
s_bedtime int Time user entered sleep mode. Seconds to/from midnight. If negative, subtract from midnight. If positive, add to midnight.
s_asleep_time int Time user fell asleep. Seconds to/from midnight. If negative, subtract from midnight. If positive, add to midnight.
s_awake_time int Final time user woke up (end of sleep period). Seconds to/from midnight. If negative, subtract from midnight. If positive, add to midnight.
s_awakenings int Number of times user awoke during the sleep period.
s_light int Number of seconds of light sleep during the sleep period.
s_deep int Number of seconds of deep sleep during the sleep period.
s_awake int Number of seconds awake during the sleep period.
s_duration int Total number of seconds of sleep during the sleep period.
s_quality int Sleep quality percentage (based on a proprietary formula of light and deep sleep to awake time).
n_bedtime int Time user entered sleep mode for nap. Seconds to/from midnight. If negative, subtract from midnight. If positive, add to midnight.
n_asleep_time int Time user fell asleep for nap. Seconds to/from midnight. If negative, subtract from midnight. If positive, add to midnight.
n_awake_time int Final time user woke up (end of nap). Seconds to/from midnight. If negative, subtract from midnight. If positive, add to midnight.
n_awakenings int Number of times user awoke during the nap.
n_light int Number of seconds of light sleep during the nap.
n_deep int Number of seconds of deep sleep during the nap.
n_awake int Number of seconds awake during the nap.
n_duration int Total number of seconds of sleep during the nap.
n_quality int Sleep quality percentage during nap (based on a proprietary formula of light and deep sleep to awake time).
next URI Link to next page of data (relative, add https://jawbone.com as prefix).