---
schema_version: "1"
id: 04b741b3639223cda1d982f8dfa7c4c4000d785fb982b0ee57da6c7c913f320c
title: Get Appointment Candidates
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/uc6-get-appointment-candidates.md
canonical_url: https://developer.salesforce.com/docs/service/salesforce-scheduler-dev-guide/guide/uc6-get-appointment-candidates.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b05d8b9d48f3e35e05d60bf8c54a974632f949434493a07162b1abd7d8021201
products:
  - Salesforce Scheduler Developer Guide
  - Service Cloud Developer Content
---

# Get Appointment Candidates

Get a list of service resources based on the work type group or work type, and service territory that are selected in the previous step. 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.

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.

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://yourInstance.salesforce.com/services/data/vXX.X/scheduling/getAppointmentCandidates
```

**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" : "001B000001McLhMIAV",
   "startTime" : "2021-10-29T08:00:00.000+0000",
   "endTime" : "2021-10-29T18:00:00.000+0000",
   "allowConcurrentScheduling" : true,
   "workTypeGroupId" : "0VSB0000000TbhWOAS",
   "territoryIds" : ["0HhB00000001P0PKAU"]
}
```

Using `workTypeId`:

```nolang

{
   "accountId" : "001B000001McLhMIAV",
   "startTime" : "2021-10-29T08:00:00.000+0000",
   "endTime" : "2021-10-29T18:00:00.000+0000",
   "allowConcurrentScheduling" : true,
   "workType" : {
                 "id" : "08qB00000002ocgIAA"
   },
   "territoryIds" : ["0HhB00000001P0PKAU"]
}
```

**Sample Response**

The API returns the available time slots and service resources.

```nolang

{
  "candidates" : [ {
    "endTime" : "2021-10-29T16:00:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T15:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T16:30:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T15:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:00:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T16:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:30:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T16:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T18:00:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T17:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T16:00:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T15:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T16:30:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T15:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:00:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T16:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:30:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T16:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T18:00:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T17:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  } ]
}
```

**For a Guest User (Lead)**

**Sample Request**

Using `workTypeGroupId`:

```nolang

{
   "startTime" : "2021-10-13T08:00:00.000+0000",
   "endTime" : "2021-10-13T18:00:00.000+0000",
   "allowConcurrentScheduling" : true,
   "workTypeGroupId" : "0VSB0000000TbhWOAS",
   "territoryIds" : ["0HhB00000001P0PKAU"],
}
```

Using `workTypeId`:

```nolang

{
   "accountId" : "001B000001McLhMIAV",
   "startTime" : "2021-10-29T08:00:00.000+0000",
   "endTime" : "2021-10-29T18:00:00.000+0000",
   "allowConcurrentScheduling" : true,
   "workType" : {
                 "id" : "08qB00000002ocgIAA"
   },
   "territoryIds" : ["0HhB00000001P0PKAU"]
}
```

**Sample Response**

The API returns the available time slots and service resources.

```nolang
{
  "candidates" : [ {
    "endTime" : "2021-10-29T16:00:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T15:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T16:30:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T15:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:00:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T16:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:30:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T16:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T18:00:00.000+0000",
    "resources" : [ "0HnB00000001SJxKAM" ],
    "startTime" : "2021-10-29T17:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T16:00:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T15:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T16:30:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T15:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:00:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T16:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T17:30:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T16:30:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  }, {
    "endTime" : "2021-10-29T18:00:00.000+0000",
    "resources" : [ "0HnB00000001SOUKA2" ],
    "startTime" : "2021-10-29T17:00:00.000+0000",
    "territoryId" : "0HhB00000001P0PKAU"
  } ]
}
```

Parse the JSON response, and show the available resources on the page so that the user can select a resource for the appointment.

Here’s how a page showing the available service resources can look.

![A representation of the Select Service Resource screen.](https://developer.salesforce.com/media/salesforce-scheduler-dev-guide/concurrent-serviceResource.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/concurrent_timeSlot.png)

On the next page in your app, you can show the appointment details for the user to review and create the appointment.

