This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a service.
function getService(
serviceId: string,
options: GetServiceOptions,
): Promise<Service>;
ID of the service to retrieve.
import { services } from "wix-bookings.v2";
/*
* Sample serviceId value: 'ff61204b-b19a-5cc8-823b-7eed8ae5fc28'
*/
async function getService(serviceId) {
try {
return services.getService(serviceId);
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
"type": "CLASS",
"sortOrder": 4,
"name": "Group Cat Hugging",
"description": "Introducing the Purrfect Hug - the ultimate cat cuddling experience! Our team of expert cuddlers will come to your home and provide your furry feline with the warmest and snuggliest hugs around.",
"tagLine": "Get some purr therapy with our cat hugging service!",
"defaultCapacity": 30,
"hidden": false,
"category": {
"name": "Our Services",
"sortOrder": 0,
"_id": "99b3c3af-3dd1-4fcd-8d97-2fcedcb2908c"
},
"payment": {
"rateType": "FIXED",
"fixed": {
"price": {
"value": "25",
"currency": "USD"
},
"deposit": {
"value": "5",
"currency": "USD"
}
},
"options": {
"online": true,
"inPerson": false,
"deposit": false,
"pricingPlan": false
},
"pricingPlanIds": []
},
"onlineBooking": {
"enabled": true
},
"locations": [
{
"type": "BUSINESS"
}
],
"bookingPolicy": {
"revision": "1",
"name": "Default policy",
"customPolicyDescription": {
"enabled": true,
"description": ""
},
"default": true,
"limitEarlyBookingPolicy": {
"enabled": false,
"earliestBookingInMinutes": 10080
},
"limitLateBookingPolicy": {
"enabled": false,
"latestBookingInMinutes": 1440
},
"bookAfterStartPolicy": {
"enabled": false
},
"cancellationPolicy": {
"enabled": true,
"limitLatestCancellation": false,
"latestCancellationInMinutes": 1440
},
"reschedulePolicy": {
"enabled": true,
"limitLatestReschedule": false,
"latestRescheduleInMinutes": 1440
},
"waitlistPolicy": {
"enabled": false,
"capacity": 10,
"reservationTimeInMinutes": 10
},
"participantsPolicy": {
"enabled": true,
"maxParticipantsPerBooking": 1
},
"resourcesPolicy": {
"enabled": false,
"autoAssignAllowed": false
},
"_id": "ede8ad9e-44e1-480e-833f-542aea019bd0",
"_createdDate": "Thu Dec 14 2023 16:14:33 GMT+0100 (Central European Standard Time)",
"_updatedDate": "Thu Dec 14 2023 16:14:33 GMT+0100 (Central European Standard Time)"
},
"schedule": {
"_id": "81aa34a4-0cbc-4476-b8ec-62878024cd97"
},
"staffMemberIds": [],
"staffMembers": [],
"resourceGroups": [],
"serviceResources": [],
"supportedSlugs": [
{
"name": "group-cat-hugging-1",
"custom": false,
"_createdDate": "Tue Jan 16 2024 17:20:11 GMT+0100 (Central European Standard Time)"
}
],
"mainSlug": {
"name": "group-cat-hugging-1",
"custom": false,
"_createdDate": "Tue Jan 16 2024 17:20:11 GMT+0100 (Central European Standard Time)"
},
"urls": {
"servicePage": "https://www.example.com/services-v2-test/service-page/group-cat-hugging-1",
"bookingPage": "https://www.example.com/services-v2-test/booking-calendar/group-cat-hugging-1",
"calendarPage": "https://www.example.com/services-v2-test/booking-calendar/group-cat-hugging-1"
},
"revision": "1",
"_id": "fad1a29c-d06b-4ce7-ab80-98c54c4e0772",
"_createdDate": "Tue Jan 16 2024 17:20:12 GMT+0100 (Central European Standard Time)",
"_updatedDate": "Tue Jan 16 2024 17:20:12 GMT+0100 (Central European Standard Time)"
}
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.