Nutrition
Introduction
Nutrition measurements capture statistics about a user’s diet. Nutrition measurements are grouped in reverse chronological order into a nutrition feed.
Feed
Because a user’s nutrition feed can grow very large, feeds are divided into pages of twenty-five nutrition measurements. Each page of a user's nutrition feed has the following structure:
| Field | Type | Description |
|---|---|---|
size |
Integer |
The total number of nutrition measurements across all pages |
items |
Item[] |
The user’s activities, from newest to oldest |
previous |
String |
The URI of the previous page in the user’s feed (omitted for the oldest page) |
next |
String |
The URI of the next page in the user’s feed (omitted for the newest page) |
Past Measurements
Past measurements have the following structure:
| Field | Type | Description | Editable |
|---|---|---|---|
| uri | String | The URI for this measurement | N |
| userID | Integer | The unique ID for the user | N |
One of the following values:
|
Double | The value of the measured quantity | Y |
| One of the following values: calories, carbohydrates, fat, fiber, protein, sodium, water | Double | The value of the measured quantity | Y |
| previous | String | The URI of the previous nutrition measurement in chronological order for the user (omitted for the first nutrition measurement) | N |
| next | String | The URI of the next nutrition measurement in chronological order for the user (omitted for the most recent nutrition measurement) | N |
| nearest_fitness_activity | String | The URI of the fitness activity closest in time to this activity for the user (omitted if no fitness activities have been recorded) | N |
| nearest_teammate_fitness_activities | String[] | The URIs of the fitness activities closest in time to this activity for each street teammate (empty if no fitness activities have been recorded) | N |
| nearest_strength_training_activity | String | The URI of the strength training activity closest in time to this activity for the user (omitted if no strength training activities have been recorded) | N |
| nearest_teammate_strength_training_activities | String[] | The URIs of the strength training activities closest in time to this activity for each street teammate (empty if no strength training activities have been recorded) | N |
| nearest_background_activity | String | The URI of the background activity closest in time to this activity for the user (omitted if no background activities have been recorded) | N |
| nearest_teammate_background_activities | String[] | The URIs of the background activities closest in time to this activity for each street teammate (empty if no background activities have been recorded) | N |
| nearest_sleep | String | The URI of the sleep measurements closest in time to this activity for the user (omitted if no sleep measurements have been taken) | N |
| nearest_teammate_sleep | String[] | The URIs of the sleep measurements closest in time to this activity for each street teammate (empty if no sleep measurements have been taken) | N |
| nearest_teammate_nutrition | String[] | The URIs of the nutrition measurement closest in time to this activity for each street teammate (empty if no nutrition measurements have been token) | N |
| nearest_weight | String | The URI of the weight measurement closest in time to this activity for the user (omitted if no weight measurements have been token) | N |
| nearest_teammate_weight | String[] | The URIs of the weight measurements closest in time to this activity for each street teammate (empty if no weight measurements have been token) | N |
| nearest_general_measurement | String | The URI of the general measurement measurement closest in time to this activity for the user (omitted if no general measurements have been token) | N |
| nearest_teammate_general_measurements | String[] | The URIs of the general measurements closest in time to this activity for each street teammate (empty if no general measurements have been token) | N |
| nearest_diabetes | String | The URI of the diabetes measurement closest in time to this activity for the user (omitted if no diabetes measurements have been token) | N |
| nearest_teammate_diabetes | String[] | The URIs of the diabetes measurements closest in time to this activity for each street teammate (empty if no diabetes measurements have been token) | N |
New Measurements
New measurements have the following structure:
| Field | Type | Description |
|---|---|---|
| timestamp | String | The time at which the measurement was taken (e.g., "Sat, 1 Jan 2011 00:00:00") |
One of the following values:
|
Double | The value of the measured quantity |
| post_to_twitter | Boolean | Whether to post this measurement to Twitter (optional; if omitted, the user's default setting will be used) |
| post_to_facebook | Boolean | Whether to post this measurement to Facebook (optional; if omitted, the user's default setting will be used) |
Array Structures
items
| Field | Type | Description |
|---|---|---|
| timestamp | String | The time at which the measurement was taken (e.g., "Sat, 1 Jan 2011 00:00:00") |
One of the following values:
|
Double | The value of the measured quantity |
| uri | String | The URI of detailed information for the nutrition measurement |
Supported Operations
Retrieving Measurement Information
To retrieve a user’s nutrition feed or a nutrition measurement,
GET
its URI.
Retrieving Headers for a Past Measurement
Header information for a past measurement can be retrieved with the
HEAD
method.
Editing a Past Measurement
To edit a past measurement,
PUT
any new values for editable fields to its URI.
Recording a New Measurement
To record a new measurement,
POST
its fields to any page in the user’s nutrition feed.
Rate Limits
The following rate limits apply to activities and their feed on a per-user, per application basis:
- For
GETrequests: 5,000 requests in a 24-hour period - For
HEADrequests: 5,000 requests in a 24-hour period - For
POSTrequests: 5,000 requests in a 24-hour period - For
PUTrequests: 5,000 requests in a 24-hour period