Get Service Appointments

The AssignedResource object represents a service resource who is assigned to a service appointment in Salesforce Scheduler. Retrieve service appointment IDs of all scheduled appointments associated with specific resources by using the query request on the AssignedResource object.

Sample Request

This sample REST API call uses the query request to retrieve the anonymous service appointments that are associated with unavailable resources.

1https://YOUR_INSTANCE.salesforce.com/services/data/vXX.X/query/?q=SELECT+ServiceAppointmentId,ServiceResourceId+FROM+AssignedResource+WHERE+ServiceResourceId+=+'SERVICE_RESOURCE_ID'+AND+ServiceAppointment.IsAnonymousBooking+=+TRUE

Where YOUR_INSTANCE and SERVICE_RESOURCE_ID are variables.

For more information, see Execute a SOQL Query. Ensure that the filter falls within the query limits.

Sample Response

The method retrieves the list of anonymous appointments that are associated with specific resources.

1{
2  "totalSize" : 2,
3  "done" : true,
4  "records" : [ 
5    {
6      "attributes" : {
7        "type" : "AssignedResource",
8        "url" : "/services/data/v53.0/sobjects/AssignedResource/03rB0000000cBVOIA2"
9      },
10      "ServiceAppointmentId" : "08pB0000000aKeYIAU",
11      "ServiceResourceId" : "0HnB0000000Tav3KAC"
12    }, 
13    {
14      "attributes" : {
15        "type" : "AssignedResource",
16        "url" : "/services/data/v53.0/sobjects/AssignedResource/03rB0000000cBVsIAM"
17      },
18      "ServiceAppointmentId" : "08pB0000000aKf2IAE",
19      "ServiceResourceId" : "0HnB0000000Tav3KAC"
20    } 
21 ]
22}

Use a collection object to capture all appointment IDs that the GET request retrieved. If you call multiple GET requests, include in the collection object the appointment IDs that each request returned.. This task helps you create a list of service appointments that you must update with new resources.