Retrieves a list of the sessions according to the specified filters and paging.
The querySessions()
function builds a query to retrieve a list of sessions, and returns a SessionQueryBuilder
object.
The returned object contains the query definition, which is typically used to run the query using the find()
function.
The SessionQueryBuilder
functions enable you to run, filter, and control
which results a query returns.
Typically, you build a query using the session query function,
refine the query by chaining SessionQueryBuilder
functions, and then execute the
query by chaining the find()
function.
The query must include the following SessionQueryBuilder
functions:
Use start
and end
to set the range of dates you want to return in your session query. Use ge("end.timestamp", "")
to set the lower limit of your query range as greater or equal to the end
date of the earliest session, and lt("start.timestamp", "")
to set the upper limit as less than the start
date of the latest session. Sessions that are partially within the requested date range will be included in the returned sessions.
The query runs with the following SessionQueryBuilder
defaults that you can override:
By default, recurring sessions, sessions that define recurrence patterns, are not returned in the query. Only instances of the recurring sessions are returned. To query recurring sessions, use .ne("recurrence",null)
and .eq("scheduleId", "")
. While instances of recurring sessions can be queried for all schedules, recurring sessions can only be queried for a specified schedule ID.
The following query builder filters are supported for querySessions()
.
Property | Supported Filters |
---|---|
scheduleId | eq() ,hasSome() |
end | ge() |
start | lt() |
tags | eq() , hasSome() |
type | eq() , hasSome() |
recurrence | ne() |
For a full description of the Session object, see the object returned for the items
property in SessionQueryResult
.
Notes:
timestamp
not specified when creating a session, it is calculated as the UTC date and time using localDateTime and the business's timezone.WORKING_HOURS
sessions for a resource that has the default business hours in its linkedSchedules
array, will not be returned in a query.suppressAuth
options to true
.