# Change Service Resource

A service resource represents an employee from your organization, such as a loan officer, investment advisor, doctor, nurse practitioner, or retail store specialist, who attends appointments with clients.

1. Create a page to show the available service resources.

2. Make a `POST` request on the [`getAppointmentCandidates`](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/requests_ls_getappointmentcandidates.htm) REST API by passing the required `workTypeId` and `territoryIds` parameters.

   **Resource URI**

   ```nolang
   https://yourInstance.salesforce.com/services/data/v68.0/scheduling/getAppointmentCandidates
   ```

   **Sample Request**

   To consider an existing user’s preferred visiting hours, pass `accountId` in the input request body. The preference is enforced when the Include Only Required Service Resources and Ignore Excluded Service Resources policy rules are enabled. For more information, see [Add Service Resource Preferences to Accounts for Salesforce Scheduler](https://help.salesforce.com/s/articleView?id=platform.ls_add_service_resource_preferences_to_accounts.htm\&type=5).

   ```nolang
   {
     "startTime": "2023-03-24T09:00:00.000+0000",
     "endTime": "2023-03-24T19:00:00.000+0000",
     "accountId": "001S7000001pFlJIAU",
     "workType": {
       "id": "08qS70000004DQsIAM"
     },
     "territoryIds": [
       "0HhS700000001DYKAY"
     ],
     "schedulingPolicyId": "2F0VrRM0000004CUV",
     "engagementChannelTypeIds": [
       "0eFS70000004CGFMA2"
     ]
   }
   ```

   **Sample Response**

   The API returns the available time slots and service resources.

   ```nolang
   {
     "candidates" : [ {
       "endTime" : "2023-03-24T17:00:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T16:00:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T17:15:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T16:15:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T17:30:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T16:30:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T17:45:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T16:45:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T18:00:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T17:00:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T18:15:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T17:15:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T18:30:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T17:30:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T18:45:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T17:45:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     }, {
       "endTime" : "2023-03-24T19:00:00.000+0000",
       "engagementChannelTypeIds" : [ "0eFS70000004CGFMA2" ],
       "resources" : [ "0HnS700000002jAKAQ" ],
       "startTime" : "2023-03-24T18:00:00.000+0000",
       "territoryId" : "0HhS700000001DYKAY"
     } ]
   }
   ```

3. Parse the JSON response, and show the available resources on the page. Your users can select a service resource for the appointment from the page.

4. Retrieve the available time slots for the selected engagement channel type and service resource. See [Change Appointment Time](/docs/service/salesforce-scheduler-dev-guide/guide/uc4-get-appointment-slots.md).

Your users can select a resource and a time slot for the appointment from the page.
