querySessions( )


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:

  • ge("end.timestamp", "")
  • lt("start.timestamp", "")

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:

  • skip: 0
  • limit: 50
  • ascending: start.timestamp

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().

PropertySupported Filters                                                           
scheduleIdeq(),hasSome()
endge()
startlt()
tagseq(), hasSome()
typeeq(), hasSome()
recurrencene()

For a full description of the Session object, see the object returned for the items property in SessionQueryResult.

Notes:

  • If timestamp not specified when creating a session, it is calculated as the UTC date and time using localDateTime and the business's timezone.
  • Sessions that occur as a result of a linked schedule are not returned in a session query. For example, WORKING_HOURS sessions for a resource that has the default business hours in its linkedSchedules array, will not be returned in a query.
  • Only users with Bookings Admin permissions can view participant information in a session query. You can override the permissions by setting the suppressAuth options to true.
Method Declaration
Copy
Request
This method does not take any parameters
Returns
Was this helpful?
Yes
No