Skip to main content

device_sessions

Creates, updates, deletes, gets or lists a device_sessions resource.

Overview

Namedevice_sessions
TypeResource
Idfirebase.testing.device_sessions

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOptional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
activeStartTimestring (google-datetime)Output only. The timestamp that the session first became ACTIVE.
androidDeviceobjectA single Android device. (id: AndroidDevice)
createTimestring (google-datetime)Output only. The time that the Session was created.
displayNamestringOutput only. The title of the DeviceSession to be presented in the UI.
expireTimestring (google-datetime)Optional. If the device is still in use at this time, any connections will be ended and the SessionState will transition from ACTIVE to FINISHED.
inactivityTimeoutstring (google-duration)Output only. The interval of time that this device must be interacted with before it transitions from ACTIVE to TIMEOUT_INACTIVITY.
statestringOutput only. Current state of the DeviceSession.
stateHistoriesarrayOutput only. The historical state transitions of the session_state message including the current session state.
ttlstring (google-duration)Optional. The amount of time that a device will be initially allocated for. This can eventually be extended with the UpdateDeviceSession RPC. Default: 15 minutes.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, deviceSessionsIdGET /v1/projects/{project_id}/deviceSessions/{device_session_id} Return a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.
listselectprojectsIdpageSize, pageToken, filterGET /v1/projects/{project_id}/deviceSessions Lists device Sessions owned by the project user.
createinsertprojectsIdPOST /v1/projects/{project_id}/deviceSessions
patchupdateprojectsId, deviceSessionsIdupdateMaskPATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.
cancelexecprojectsId, deviceSessionsIdPOST /v1/projects/{project_id}/deviceSessions/{device_session_id}:cancel Changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deviceSessionsIdstring
projectsIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

GET /v1/projects/{project_id}/deviceSessions/{device_session_id} Return a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.

SELECT
name,
activeStartTime,
androidDevice,
createTime,
displayName,
expireTime,
inactivityTimeout,
state,
stateHistories,
ttl
FROM firebase.testing.device_sessions
WHERE projectsId = '{{ projectsId }}' -- required
AND deviceSessionsId = '{{ deviceSessionsId }}' -- required;

INSERT examples

POST /v1/projects/{project_id}/deviceSessions

INSERT INTO firebase.testing.device_sessions (
data__name,
data__ttl,
data__expireTime,
data__androidDevice,
projectsId
)
SELECT
'{{ name }}',
'{{ ttl }}',
'{{ expireTime }}',
'{{ androidDevice }}',
'{{ projectsId }}'
RETURNING
name,
activeStartTime,
androidDevice,
createTime,
displayName,
expireTime,
inactivityTimeout,
state,
stateHistories,
ttl
;

UPDATE examples

PATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.

UPDATE firebase.testing.device_sessions
SET
data__name = '{{ name }}',
data__ttl = '{{ ttl }}',
data__expireTime = '{{ expireTime }}',
data__androidDevice = '{{ androidDevice }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND deviceSessionsId = '{{ deviceSessionsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
activeStartTime,
androidDevice,
createTime,
displayName,
expireTime,
inactivityTimeout,
state,
stateHistories,
ttl;

Lifecycle Methods

POST /v1/projects/{project_id}/deviceSessions/{device_session_id}:cancel Changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.

EXEC firebase.testing.device_sessions.cancel 
@projectsId='{{ projectsId }}' --required,
@deviceSessionsId='{{ deviceSessionsId }}' --required;