Skip to main content

sessions

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

Overview

Namesessions
TypeResource
Idgoogle.discoveryengine.sessions

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringImmutable. Fully qualified name projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*
displayNamestringOptional. The display name of the session. This field is used to identify the session in the UI. By default, the display name is the first turn query text in the session.
endTimestring (google-datetime)Output only. The time the session finished.
isPinnedbooleanOptional. Whether the session is pinned, pinned session will be displayed on the top of the session list.
startTimestring (google-datetime)Output only. The time the session started.
statestringThe state of the session.
turnsarrayTurns.
userPseudoIdstringA unique identifier for tracking users.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_collections_data_stores_sessions_getselectprojectsId, locationsId, collectionsId, dataStoresId, sessionsIdincludeAnswerDetailsGets a Session.
projects_locations_collections_engines_sessions_getselectprojectsId, locationsId, collectionsId, enginesId, sessionsIdincludeAnswerDetailsGets a Session.
projects_locations_collections_data_stores_sessions_listselectprojectsId, locationsId, collectionsId, dataStoresIdpageSize, pageToken, filter, orderByLists all Sessions by their parent DataStore.
projects_locations_collections_engines_sessions_listselectprojectsId, locationsId, collectionsId, enginesIdpageSize, pageToken, filter, orderByLists all Sessions by their parent DataStore.
projects_locations_data_stores_sessions_getselectprojectsId, locationsId, dataStoresId, sessionsIdincludeAnswerDetailsGets a Session.
projects_locations_data_stores_sessions_listselectprojectsId, locationsId, dataStoresIdpageSize, pageToken, filter, orderByLists all Sessions by their parent DataStore.
projects_locations_collections_data_stores_sessions_createinsertprojectsId, locationsId, collectionsId, dataStoresIdCreates a Session. If the Session to create already exists, an ALREADY_EXISTS error is returned.
projects_locations_collections_engines_sessions_createinsertprojectsId, locationsId, collectionsId, enginesIdCreates a Session. If the Session to create already exists, an ALREADY_EXISTS error is returned.
projects_locations_data_stores_sessions_createinsertprojectsId, locationsId, dataStoresIdCreates a Session. If the Session to create already exists, an ALREADY_EXISTS error is returned.
projects_locations_collections_data_stores_sessions_patchupdateprojectsId, locationsId, collectionsId, dataStoresId, sessionsIdupdateMaskUpdates a Session. Session action type cannot be changed. If the Session to update does not exist, a NOT_FOUND error is returned.
projects_locations_collections_engines_sessions_patchupdateprojectsId, locationsId, collectionsId, enginesId, sessionsIdupdateMaskUpdates a Session. Session action type cannot be changed. If the Session to update does not exist, a NOT_FOUND error is returned.
projects_locations_data_stores_sessions_patchupdateprojectsId, locationsId, dataStoresId, sessionsIdupdateMaskUpdates a Session. Session action type cannot be changed. If the Session to update does not exist, a NOT_FOUND error is returned.
projects_locations_collections_data_stores_sessions_deletedeleteprojectsId, locationsId, collectionsId, dataStoresId, sessionsIdDeletes a Session. If the Session to delete does not exist, a NOT_FOUND error is returned.
projects_locations_collections_engines_sessions_deletedeleteprojectsId, locationsId, collectionsId, enginesId, sessionsIdDeletes a Session. If the Session to delete does not exist, a NOT_FOUND error is returned.
projects_locations_data_stores_sessions_deletedeleteprojectsId, locationsId, dataStoresId, sessionsIdDeletes a Session. If the Session to delete does not exist, a NOT_FOUND error is returned.

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
collectionsIdstring
dataStoresIdstring
enginesIdstring
locationsIdstring
projectsIdstring
sessionsIdstring
filterstring
includeAnswerDetailsboolean
orderBystring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a Session.

SELECT
name,
displayName,
endTime,
isPinned,
startTime,
state,
turns,
userPseudoId
FROM google.discoveryengine.sessions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND collectionsId = '{{ collectionsId }}' -- required
AND dataStoresId = '{{ dataStoresId }}' -- required
AND sessionsId = '{{ sessionsId }}' -- required
AND includeAnswerDetails = '{{ includeAnswerDetails }}';

INSERT examples

Creates a Session. If the Session to create already exists, an ALREADY_EXISTS error is returned.

INSERT INTO google.discoveryengine.sessions (
data__name,
data__displayName,
data__state,
data__userPseudoId,
data__turns,
data__isPinned,
projectsId,
locationsId,
collectionsId,
dataStoresId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ state }}',
'{{ userPseudoId }}',
'{{ turns }}',
{{ isPinned }},
'{{ projectsId }}',
'{{ locationsId }}',
'{{ collectionsId }}',
'{{ dataStoresId }}'
RETURNING
name,
displayName,
endTime,
isPinned,
startTime,
state,
turns,
userPseudoId
;

UPDATE examples

Updates a Session. Session action type cannot be changed. If the Session to update does not exist, a NOT_FOUND error is returned.

UPDATE google.discoveryengine.sessions
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__state = '{{ state }}',
data__userPseudoId = '{{ userPseudoId }}',
data__turns = '{{ turns }}',
data__isPinned = {{ isPinned }}
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND collectionsId = '{{ collectionsId }}' --required
AND dataStoresId = '{{ dataStoresId }}' --required
AND sessionsId = '{{ sessionsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
displayName,
endTime,
isPinned,
startTime,
state,
turns,
userPseudoId;

DELETE examples

Deletes a Session. If the Session to delete does not exist, a NOT_FOUND error is returned.

DELETE FROM google.discoveryengine.sessions
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND collectionsId = '{{ collectionsId }}' --required
AND dataStoresId = '{{ dataStoresId }}' --required
AND sessionsId = '{{ sessionsId }}' --required;