Change Appointment Time Slots
Create a page in your app to show the selected primary resource, other required resources,
including assets, and the consolidated time slots for the primary service resource and
required resources that users select. Here’s how a page can look.
When the user selects one or more required resources, refresh the available time slots by making a POST request to the getAppointmentSlots REST API and passing the selected required resources along with the workTypeGroupId and territoryId parameters.
- Resource URI
-
https://yourInstance.salesforce.com/services/data/vXX.X/scheduling/getAppointmentSlots
- Sample Request
-
{ "startTime" : "2021-10-04T17:00:00.000+0000", "endTime" : "2021-10-04T18:00:00.000+0000", "workTypeId" : { "08qB0000000Tf1FIAS" }, "accountId" : "001B000001McLhMIAV", "territoryIds" : ["0HhB0000000TaHOKA0"], "primaryResourceId" : "0HnB0000000TavDKAS", "requiredResourceIds" : ["0HnB0000000DynTKAS", "0HnB0000000Tav3KAC"] }
- Sample Response
-
The API returns the time slots where the selected primary resource and required resources are available for the multi-resource service appointment.
{ "timeSlots" : [ { "endTime" : "2021-10-04T18:00:00.000+0000", "startTime" : "2021-10-04T17:00:00.000+0000", "territoryId" : "0HhB0000000TaHOKA0" }, { "endTime" : "2021-10-04T19:00:00.000+0000", "startTime" : "2021-10-04T17:00:00.000+0000", "territoryId" : "0HhB0000000TaHOKA0" }, { "endTime" : "2021-10-04T20:00:00.000+0000", "startTime" : "2021-10-04T17:30:00.000+0000", "territoryId" : "0HhB0000000TaHOKA0" }, { "endTime" : "2021-10-04T18:00:00.000+0000", "startTime" : "2021-10-04T17:00:00.000+0000", "territoryId" : "0HhB0000000TaHOKA0" }, { "endTime" : "2021-10-04T18:30:00.000+0000", "startTime" : "2021-10-04T17:30:00.000+0000", "territoryId" : "0HhB0000000TaHOKA0" }, { "endTime" : "2021-10-04T18:00:00.000+0000", "startTime" : "2021-10-04T17:00:00.000+0000", "territoryId" : "0HhB0000000TaHOKA0" } ] }

On the next page in your app, you can show the appointment details for the user to review and create the appointment.