Users.sessions: list

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
activityType
integer
If non-empty, only sessions with these activity types should be returned.
endTime
string
An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response. If this time is omitted but startTime is specified, all sessions from startTime to the end of time will be returned.
includeDeleted
boolean
If true, and if both startTime and endTime are omitted, session deletions will be returned.
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. 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. If this time is omitted but endTime is specified, all sessions from the start of time up to endTime will be returned.

Authorization

This request requires authorization with at least one of the following scopes:

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

For more information, see the authentication and authorization page.

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, and startTime and endTime are omitted, this will include sessions which were deleted since the last sync.
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 sync token which is used to sync further changes. This will only be provided if both startTime and endTime are omitted from the request.
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. DO NOT USE THIS FIELD. It is never populated in responses from the server.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Create a Mobile Website
View Site in Mobile | Classic
Share by: