const bookingsApi = client.bookingsApi;
BookingsApi
- List Bookings
- Create Booking
- Search Availability
- Retrieve Business Booking Profile
- List Team Member Booking Profiles
- Retrieve Team Member Booking Profile
- Retrieve Booking
- Update Booking
- Cancel Booking
Retrieve a collection of bookings.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ
and APPOINTMENTS_READ
for the OAuth scope.
async listBookings(
limit?: number,
cursor?: string,
teamMemberId?: string,
locationId?: string,
startAtMin?: string,
startAtMax?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListBookingsResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
number | undefined |
Query, Optional | The maximum number of results per page to return in a paged response. |
cursor |
string | undefined |
Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
teamMemberId |
string | undefined |
Query, Optional | The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved. |
locationId |
string | undefined |
Query, Optional | The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved. |
startAtMin |
string | undefined |
Query, Optional | The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used. |
startAtMax |
string | undefined |
Query, Optional | The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after start_at_min is used. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await bookingsApi.listBookings();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Creates a booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE
and APPOINTMENTS_WRITE
for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
async createBooking(
body: CreateBookingRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CreateBookingResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateBookingRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyBooking: Booking = {};
const body: CreateBookingRequest = {
booking: bodyBooking,
};
try {
const { result, ...httpResponse } = await bookingsApi.createBooking(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Searches for availabilities for booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ
and APPOINTMENTS_READ
for the OAuth scope.
async searchAvailability(
body: SearchAvailabilityRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<SearchAvailabilityResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchAvailabilityRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyQueryFilterStartAtRange: TimeRange = {};
const bodyQueryFilter: SearchAvailabilityFilter = {
startAtRange: bodyQueryFilterStartAtRange,
};
const bodyQuery: SearchAvailabilityQuery = {
filter: bodyQueryFilter,
};
const body: SearchAvailabilityRequest = {
query: bodyQuery,
};
try {
const { result, ...httpResponse } = await bookingsApi.searchAvailability(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves a seller's booking profile.
async retrieveBusinessBookingProfile(
requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveBusinessBookingProfileResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
RetrieveBusinessBookingProfileResponse
try {
const { result, ...httpResponse } = await bookingsApi.retrieveBusinessBookingProfile();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Lists booking profiles for team members.
async listTeamMemberBookingProfiles(
bookableOnly?: boolean,
limit?: number,
cursor?: string,
locationId?: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<ListTeamMemberBookingProfilesResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
bookableOnly |
boolean | undefined |
Query, Optional | Indicates whether to include only bookable team members in the returned result (true ) or not (false ).Default: false |
limit |
number | undefined |
Query, Optional | The maximum number of results to return in a paged response. |
cursor |
string | undefined |
Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
locationId |
string | undefined |
Query, Optional | Indicates whether to include only team members enabled at the given location in the returned result. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
ListTeamMemberBookingProfilesResponse
const bookableOnly = false;
try {
const { result, ...httpResponse } = await bookingsApi.listTeamMemberBookingProfiles(bookableOnly);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves a team member's booking profile.
async retrieveTeamMemberBookingProfile(
teamMemberId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveTeamMemberBookingProfileResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
string |
Template, Required | The ID of the team member to retrieve. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
RetrieveTeamMemberBookingProfileResponse
const teamMemberId = 'team_member_id0';
try {
const { result, ...httpResponse } = await bookingsApi.retrieveTeamMemberBookingProfile(teamMemberId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves a booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ
and APPOINTMENTS_READ
for the OAuth scope.
async retrieveBooking(
bookingId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveBookingResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
bookingId |
string |
Template, Required | The ID of the Booking object representing the to-be-retrieved booking. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const bookingId = 'booking_id4';
try {
const { result, ...httpResponse } = await bookingsApi.retrieveBooking(bookingId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Updates a booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE
and APPOINTMENTS_WRITE
for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
async updateBooking(
bookingId: string,
body: UpdateBookingRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<UpdateBookingResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
bookingId |
string |
Template, Required | The ID of the Booking object representing the to-be-updated booking. |
body |
UpdateBookingRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const bookingId = 'booking_id4';
const contentType = null;
const bodyBooking: Booking = {};
const body: UpdateBookingRequest = {
booking: bodyBooking,
};
try {
const { result, ...httpResponse } = await bookingsApi.updateBooking(bookingId, body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Cancels an existing booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE
and APPOINTMENTS_WRITE
for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
async cancelBooking(
bookingId: string,
body: CancelBookingRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CancelBookingResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
bookingId |
string |
Template, Required | The ID of the Booking object representing the to-be-cancelled booking. |
body |
CancelBookingRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const bookingId = 'booking_id4';
const contentType = null;
const body: CancelBookingRequest = {};
try {
const { result, ...httpResponse } = await bookingsApi.cancelBooking(bookingId, body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}