getSession( )
Gets a session.
Description
The getSession()
function returns a Promise that resolves to a session with the specified session ID.
Note: Only users with Bookings Admin permissions can view participant information in a retrieved session. You can override the permissions by setting the
suppressAuth
options totrue
.
Syntax
function getSession(sessionId: string, [options: Options]): Promise<Session>
getSession Parameters
NAME
TYPE
DESCRIPTION
ID of the session to retrieve.
An object representing the available options for getting a session.
Returns
Fulfilled - Session.
Return Type:
NAME
TYPE
DESCRIPTION
Session ID.
ID of the schedule that the session belongs to.
ID of the resource or service that the session's schedule belongs to.
Tags for the session. The value is inherited from the schedule and can be overridden unless the session is a recurring session.
Additional information about the session. Notes are not supported for recurring sessions.
Session status.
One of:
"CONFIRMED"
Default value."CANCELLED"
The session was deleted.
ID of the recurring session if this session is an instance of a recurrence. Use this ID to update the recurrence and all of the instances.
Session type.
One of:
"EVENT"
Reserved period of time on the schedule. For example, an appointment, class, course, or blocked time. Events are visible in the Dashboard in the Bookings app's Booking Calendar page."WORKING_HOURS"
Placeholder for available time on a resource’s schedule.
String representing a recurrence rule (RRULE) for a recurring session, as defined in iCalendar RFC 5545.
If the session is an instance of a recurrence pattern, the instanceOfRecurrence
property will contain the recurrence rule and this property will be empty.
The RRULE defines a rule for repeating a session.
Supported parameters are:
Keyword | Description | Supported values |
---|---|---|
FREQ | The frequency at which the session is recurs. Required. | WEEKLY |
INTERVAL | How often, in terms of FREQ , the session recurs. Default is 1. Optional. | |
UNTIL | The UTC end date and time of the recurrence. Optional. | |
BYDAY | Day of the week when the event should recur. Required. | One of: MO , TU , WE , TH , FR , SA , SU |
For example, a session that repeats every second week on a Monday until January 7, 2022 at 8 AM:
"FREQ=WEEKLY;INTERVAL=2;BYDAY=MO;UNTIL=20220107T080000Z"
String representing a recurrence rule (RRULE) if the session is an instance of a recurrence pattern.
Empty when the session is not an instance of a recurrence rule, or if the session defines a recurrence pattern, and recurrence
is not empty.
An object specifying the start date and time of the session. If the session is a recurring session, start
must contain a localDateTime
.
An object specifying the end date and time of the session. If the session is a recurring session, end
must contain a localDateTime
.
Was this helpful?
Gets a session.
12import { Permissions, webMethod } from "wix-web-module";3import { sessions } from "wix-bookings-backend";45export const myGetSession = webMethod(Permissions.Anyone, (sessionId) => {6 return sessions.getSession(sessionId, { suppressAuth: true })7 .then((session) => {8 return session9 })10 .catch((error) => {11 console.error("Failed to get the session:", error);12 });13});1415/* Returns a Promise that resolves to a session object:16 *17 * {18 * "_id":"193...Jzp",19 * "start": {20 * "localDateTime": {21 * "year": 2021,22 * "monthOfYear": 1,23 * "dayOfMonth": 1,24 * "hourOfDay": 10,25 * "minutesOfHour": 026 * },27 * "timestamp": "2021-01-01T15:00:00.000Z"28 * },29 * "end": {30 * "localDateTime": {31 * "year": 2021,32 * "monthOfYear": 1,33 * "dayOfMonth": 1,34 * "hourOfDay": 11,35 * "minutesOfHour": 036 * },37 * "timestamp": "2021-01-01T16:00:00.000Z"38 * },39 * "notes": "",40 * "recurringSessionId": "53616b1f0c3c45a1b282675acd248179-44539bfb63ae496693109b6cb3a65a65",41 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",42 * "scheduleOwnerId": "b71df756-309f-468e-aec2-f82b9a9a9441",43 * "status": "CONFIRMED",44 * "tags": [45 * "GROUP"46 * ],47 * "type": "EVENT"48 * }49 */50