Search.../

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 to true.

Syntax

function getSession(sessionId: string, [options: Options]): Promise<Session>

getSession Parameters

NAME
TYPE
DESCRIPTION
sessionId
string

ID of the session to retrieve.

options
Optional
Options

An object representing the available options for getting a session.

Returns

Fulfilled - Session.

Return Type:

Promise<Session>
NAME
TYPE
DESCRIPTION
_id
string

Session ID.

scheduleId
string

ID of the schedule that the session belongs to.

scheduleOwnerId
string

ID of the resource or service that the session's schedule belongs to.

tags
Array<string>

Tags for the session. The value is inherited from the schedule and can be overridden unless the session is a recurring session.

notes
string

Additional information about the session. Notes are not supported for recurring sessions.

status
string

Session status.

One of:

  • "CONFIRMED" Default value.
  • "CANCELLED" The session was deleted.
recurringSessionId
string

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.

type
string

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.
recurrence
string

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:

KeywordDescriptionSupported values
FREQThe frequency at which the session is recurs. Required.WEEKLY
INTERVALHow often, in terms of FREQ, the session recurs. Default is 1. Optional.
UNTILThe UTC end date and time of the recurrence. Optional.
BYDAYDay 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"

instanceOfRecurrence
string

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.

start
CalendarDateTime

An object specifying the start date and time of the session. If the session is a recurring session, start must contain a localDateTime.

end
CalendarDateTime

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.

Copy Code
1
2import { Permissions, webMethod } from "wix-web-module";
3import { sessions } from "wix-bookings-backend";
4
5export const myGetSession = webMethod(Permissions.Anyone, (sessionId) => {
6 return sessions.getSession(sessionId, { suppressAuth: true })
7 .then((session) => {
8 return session
9 })
10 .catch((error) => {
11 console.error("Failed to get the session:", error);
12 });
13});
14
15/* 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": 0
26 * },
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": 0
36 * },
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