Background Activities
Introduction
Background activities describe physical activity that occurs normally throughout the day, such has calories burned or total steps taken. Unlike fitness activities, background activities are not specifically undertaken by a user, but rather occur naturally "in the background". Background activities are grouped in reverse chronological order, into a background activity feed.
Feed
Because a user’s activity feed can grow very large, feeds are divided into pages of 25 activities at a time. Each page contains links to the previous and next pages as well as the total number of activities across all pages. Each page of a user's activity feed has the following structure:
| Field | Type | Description |
|---|---|---|
size |
Integer |
The total number of fitness activities 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 Activities
Past activities have the following structure:
| Field | Type | Description | Editable |
|---|---|---|---|
uri |
String |
The URI for this activity | N |
userID |
Integer |
The unique ID for the user | N |
timestamp |
String |
The timestamp (e.g., Sat, 1 Jan 2011
00:00:00)
|
N |
One of the following values:
|
Double |
The value of the measured quantity | Y |
previous |
String |
The URI of the previous activity for the user (omitted for the oldest activity) | N |
next |
String |
The URI of the next activity for the user (omitted for the most-recent activity) | 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_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_nutrition |
String |
The URI of the nutrition measurement closest in time to this activity for the user (omitted if no nutrition measurements have been token) | 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 |
Newly-Completed Activities
Newly-completed activities have the following structure:
| Field | Type | Description |
|---|---|---|
timestamp |
String |
The timestamp (e.g., Sat, 1 Jan 2011
00:00:00)
|
One of the following values:
|
Double |
The value of the measured quantity |
Array Structures
items
| Field | Type | Description |
|---|---|---|
timestamp |
String |
The timestamp for the activity (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 activity |
Supported Operations
Retrieving Activity Information
To retrieve a page of a user’s activity history or information for
a past activity,
GET
its URI.
Retrieving Headers for a Past Activity
Header information for a past activity can be retrieved with the
HEAD
method.
Editing a Past Activity
To edit a past activity,
PUT
any new values for editable fields to its URI.
Recording An Activity
To record a newly-completed activity, or to begin recording a live
activity,
POST
its fields to any page in the user’s activity history.
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