# 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.

```nolang
https://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](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm). 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.

```nolang
{
  "totalSize" : 2,
  "done" : true,
  "records" : [ 
    {
      "attributes" : {
        "type" : "AssignedResource",
        "url" : "/services/data/v53.0/sobjects/AssignedResource/03rB0000000cBVOIA2"
      },
      "ServiceAppointmentId" : "08pB0000000aKeYIAU",
      "ServiceResourceId" : "0HnB0000000Tav3KAC"
    }, 
    {
      "attributes" : {
        "type" : "AssignedResource",
        "url" : "/services/data/v53.0/sobjects/AssignedResource/03rB0000000cBVsIAM"
      },
      "ServiceAppointmentId" : "08pB0000000aKf2IAE",
      "ServiceResourceId" : "0HnB0000000Tav3KAC"
    } 
 ]
}
```

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.
