---
schema_version: "1"
id: bd4e019f461aaca3b7e4c3d22346f1736ae3c4c8b687e1731dfc0b0b5ab083c3
title: Get Service Resources
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/salesforce-scheduler-dev-guide/guides/salesforce-scheduler/uc9-get-appointment-candidates.md
canonical_url: https://developer.salesforce.com/docs/service/salesforce-scheduler-dev-guide/guide/uc9-get-appointment-candidates.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 67f08f021cc2bca009c66927b0f4f7a290e9ebfb041e4b79492a69bc2a96a3a7
products:
  - Salesforce Scheduler Developer Guide
  - Service Cloud Developer Content
---

# Get Service Resources

Retrieve the available service resources based on the selected work type group or work type, and service territory.

A service resource is an employee from your organization, such as a loan officer, investment advisor, doctor, nurse practitioner, or retail store specialist, who attends appointments with clients.

Create a page in your app where you can show the available service resources based on the work type group or work type, and service territory.

1.  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 `workTypeGroupId` or `workTypeId`, and `territoryIds` parameters.

    **Resource URI**

    ```nolang
    https://YOUR_INSTANCE.salesforce.com/services/data/vXX.X/scheduling/getAppointmentCandidates
    ```

    Where `YOUR_INSTANCE` is a variable.

    **For an Existing User (Account)**

    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.

    **Sample Request**

    Using `workTypeGroupId`:

    ```nolang
    {
      "accountId": "001x0000005DLxpAAG",
      "startTime": "2022-04-19T10:30:00.000+0000",
      "endTime": "2022-04-19T10:40:00.000+0000",
      "workTypeGroupId": "0VSx000000014DmGAI",
      "territoryIds": [
        "0Hhx000000012oSCAQ"
      ]
    }
    ```

    Using `workTypeId`:

    ```nolang
    {
       "accountId" : "001x0000005DLxpAAG",
       "startTime" : "2022-04-19T10:30:00.000+0000",
       "endTime" : "2022-04-19T10:40:00.000+0000",
       "workType" : {
                     "id" : "08qx000000014fnAAA"
       },
       "territoryIds" : ["0Hhx000000012oSCAQ"]
    }
    ```

    **Sample Response**

    The API returns the service resources and their available time slots.

    ```nolang
    {
      "candidates": [
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GcCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GfCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GbCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GwCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GyCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GuCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GtCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GsCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GmCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GnCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GlCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006H4CAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006H2CAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006H3CAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        }
      ]
    }
    ```

    **For a Guest User (Lead)**

    **Sample Request**

    Using `workTypeGroupId`:

    ```nolang
    {
      "startTime": "2022-04-19T10:30:00.000+0000",
      "endTime": "2022-04-19T10:40:00.000+0000",
      "workTypeGroupId": "0VSx000000014DmGAI",
      "territoryIds": [
        "0Hhx000000012oSCAQ"
      ]
    }
    ```

    Using `workTypeId`:

    ```nolang
    {
      "startTime": "2022-04-19T10:30:00.000+0000",
      "endTime": "2022-04-19T10:40:00.000+0000",
      "workType": {
        "id": "08qx000000014fnAAA"
      },
      "territoryIds": [
        "0Hhx000000012oSCAQ"
      ]
    }
    ```

    **Sample Response**

    The API returns the service resources and their available time slots.

    ```nolang
    {
      "candidates": [
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GcCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GfCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GbCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GwCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GyCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GuCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GtCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GsCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GmCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GnCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006GlCAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006H4CAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006H2CAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        },
        {
          "endTime": "2022-04-19T10:40:00.000+0000",
          "resources": [
            "0Hnx000000006H3CAI"
          ],
          "startTime": "2022-04-19T10:30:00.000+0000",
          "territoryId": "0Hhx000000012oSCAQ"
        }
      ]
    }
    ```


Parse the JSON response, and display the available service resources on web page so that users can select a service resource for the appointment. Here’s how that page can look.

![A representation of the Select Service Resource screen.](https://developer.salesforce.com/media/salesforce-scheduler-dev-guide/uc9_select_service_resource.png)

When users select a resource, show the available time slots for the selected resource. Here’s how a page showing the available time slots can look.

![A representation of the Select Service Appointment Time screen.](https://developer.salesforce.com/media/salesforce-scheduler-dev-guide/uc9_select_appointment_time.png)

On the next page in your app, you can show the appointment details for the user to review and create the appointment.

