Requires authorization
Lists sessions previously created. Try it now.
Request
HTTP request
GET https://www.googleapis.com/fitness/v1/users/userId/sessions
Parameters
Parameter name | Value | Description |
---|---|---|
Path parameters | ||
userId |
string |
List sessions for the person identified. Use me to indicate
the authenticated user. Only me is supported at this time.
|
Optional query parameters | ||
endTime |
string |
An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response. |
includeDeleted |
boolean |
If true, deleted sessions will be returned. When set to true, sessions returned in this response will only have an ID and will not have any other fields. |
pageToken |
string |
The continuation token, which is used for incremental syncing.
To get the next batch of changes, set this parameter to the value of
nextPageToken from the previous response.
This token is treated as a timestamp (in millis since epoch). If specified,
the API returns sessions modified since this time. The page token is
ignored if either start or end time is specified. If none of start time,
end time, and the page token is specified, sessions modified in the last
30 days are returned.
|
startTime |
string |
An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response. |
Authorization
This request requires authorization with at least one of the following scopes (read more about authentication and authorization).
Scope |
---|
https://www.googleapis.com/auth/fitness.activity.read |
https://www.googleapis.com/auth/fitness.activity.write |
https://www.googleapis.com/auth/fitness.location.read |
https://www.googleapis.com/auth/fitness.location.write |
https://www.googleapis.com/auth/fitness.body.read |
https://www.googleapis.com/auth/fitness.body.write |
https://www.googleapis.com/auth/fitness.nutrition.read |
https://www.googleapis.com/auth/fitness.nutrition.write |
https://www.googleapis.com/auth/fitness.blood_pressure.read |
https://www.googleapis.com/auth/fitness.blood_pressure.write |
https://www.googleapis.com/auth/fitness.blood_glucose.read |
https://www.googleapis.com/auth/fitness.blood_glucose.write |
https://www.googleapis.com/auth/fitness.oxygen_saturation.read |
https://www.googleapis.com/auth/fitness.oxygen_saturation.write |
https://www.googleapis.com/auth/fitness.body_temperature.read |
https://www.googleapis.com/auth/fitness.body_temperature.write |
https://www.googleapis.com/auth/fitness.reproductive_health.read |
https://www.googleapis.com/auth/fitness.reproductive_health.write |
Request body
Do not supply a request body with this method.
Response
If successful, this method returns a response body with the following structure:
{ "session": [ { "id": string, "name": string, "description": string, "startTimeMillis": long, "endTimeMillis": long, "modifiedTimeMillis": long, "application": { "packageName": string, "version": string, "detailsUrl": string, "name": string }, "activityType": integer, "activeTimeMillis": long } ], "deletedSession": [ { "id": string, "name": string, "description": string, "startTimeMillis": long, "endTimeMillis": long, "modifiedTimeMillis": long, "application": { "packageName": string, "version": string, "detailsUrl": string, "name": string }, "activityType": integer, "activeTimeMillis": long } ], "nextPageToken": string, "hasMoreData": boolean }
Property name | Value | Description | Notes |
---|---|---|---|
session[] |
list |
Sessions with an end time that is between startTime and endTime of the request. | |
session[].id |
string |
A client-generated identifier that is unique across all sessions owned by this particular user. | |
session[].name |
string |
A human readable name of the session. | |
session[].description |
string |
A description for this session. | |
session[].startTimeMillis |
long |
A start time, in milliseconds since epoch, inclusive. | |
session[].endTimeMillis |
long |
An end time, in milliseconds since epoch, inclusive. | |
session[].modifiedTimeMillis |
long |
A timestamp that indicates when the session was last modified. | |
session[].application |
nested object |
The application that created the session. | |
session[].application.packageName |
string |
Package name for this application. This is used as a unique identifier when created by Android applications, but cannot be specified by REST clients. REST clients will have their developer project number reflected into the Data Source data stream IDs, instead of the packageName. | |
session[].application.version |
string |
Version of the application. You should update this field whenever the application changes in a way that affects the computation of the data. | |
session[].application.detailsUrl |
string |
An optional URI that can be used to link back to the application. | |
session[].application.name |
string |
The name of this application. This is required for REST clients, but we do not enforce uniqueness of this name. It is provided as a matter of convenience for other developers who would like to identify which REST created an Application or Data Source. | |
session[].activityType |
integer |
The type of activity this session represents. | |
deletedSession[] |
list |
If includeDeleted is set to true in the request, this list will contain sessions deleted with original end times that are within the startTime and endTime frame. |
|
deletedSession[].id |
string |
A client-generated identifier that is unique across all sessions owned by this particular user. | |
deletedSession[].name |
string |
A human readable name of the session. | |
deletedSession[].description |
string |
A description for this session. | |
deletedSession[].startTimeMillis |
long |
A start time, in milliseconds since epoch, inclusive. | |
deletedSession[].endTimeMillis |
long |
An end time, in milliseconds since epoch, inclusive. | |
deletedSession[].modifiedTimeMillis |
long |
A timestamp that indicates when the session was last modified. | |
deletedSession[].application |
nested object |
The application that created the session. | |
deletedSession[].application.packageName |
string |
Package name for this application. This is used as a unique identifier when created by Android applications, but cannot be specified by REST clients. REST clients will have their developer project number reflected into the Data Source data stream IDs, instead of the packageName. | |
deletedSession[].application.version |
string |
Version of the application. You should update this field whenever the application changes in a way that affects the computation of the data. | |
deletedSession[].application.detailsUrl |
string |
An optional URI that can be used to link back to the application. | |
deletedSession[].application.name |
string |
The name of this application. This is required for REST clients, but we do not enforce uniqueness of this name. It is provided as a matter of convenience for other developers who would like to identify which REST created an Application or Data Source. | |
deletedSession[].activityType |
integer |
The type of activity this session represents. | |
nextPageToken |
string |
The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. | |
session[].activeTimeMillis |
long |
Session active time. While start_time_millis and end_time_millis define the full session time, the active time can be shorter and specified by active_time_millis. If the inactive time during the session is known, it should also be inserted via a com.google.activity.segment data point with a STILL activity value |
|
deletedSession[].activeTimeMillis |
long |
Session active time. While start_time_millis and end_time_millis define the full session time, the active time can be shorter and specified by active_time_millis. If the inactive time during the session is known, it should also be inserted via a com.google.activity.segment data point with a STILL activity value |
|
hasMoreData |
boolean |
Flag to indicate server has more data to transfer |
Try it!
Use the APIs Explorer below to call this method on live data and see the response.