A service appointment represents an appointment booked through Salesforce Scheduler. To create an appointment, make a POST request on the service-appointments Connect API.
Create a page where the user can review the appointment details and create the appointment. Here’s how a Review Service Appointment page can look.
note: To keep the service resource private, hide the resource’s name on the review appointment page.

Link the Next button to a POST request on the service-appointments Connect API to create the service appointment.
Resource URI
https://yourInstance.salesforce.com/services/data/vXX.X/connect/scheduling/service-appointments
For an Existing User (Account)
Sample Request
Pass the account ID as parentRecordId in the input request body.
Set IsAnonymousBooking to true to indicate that the appointment is anonymous.
{
"serviceAppointment": {
"serviceTerritoryId": "0Hh2w000000XmoXCAS",
"parentRecordId" : "001B000001McLhMIAV", //accountId
"schedStartTime" : "2021-05-24T15:30:00:00.000+0000",
"schedEndTime": "2021-05-24T16:30:00.000+0000",
"street": "1 Market Street",
"city": "San Francisco",
"state": "CA",
"postalCode": "94105",
"country": "USA",
"extendedFields" : [ {
"name": "IsAnonymousBooking",
"value": "true"
} ]
},
"assignedResources": [
{
"serviceResourceId": "0HnB0000000LVbfKAG",
"extendedFields" : []
}
]
}
Sample Response
The API returns the service appointment ID and the assigned service resources.
{
"result" : {
"assignedResourceIds" : [ "0HnB0000000LVbfKAG" ],
"serviceAppointmentId" : "08pB0000000hvR6IAI"
}
}
For a Guest User (Lead)
Sample Request
Pass the required lead details in the input request body.
Set IsAnonymousBooking to true to indicate that the appointment is anonymous.
{
"serviceAppointment": {
"serviceTerritoryId": "0Hh2w000000XmoXCAS",
"schedStartTime" : "2021-05-24T15:30:00:00.000+0000",
"schedEndTime": "2021-05-24T16:30:00.000+0000",
"street": "1 Market Street",
"city": "San Francisco",
"state": "CA",
"postalCode": "94105",
"country": "USA",
"extendedFields" : [ {
"name": "IsAnonymousBooking",
"value": "true"
} ]
},
"assignedResources": [
{
"serviceResourceId": "0HnB0000000LVbfKAG",
"isRequiredResource": true,
"isPrimaryResource": true,
"extendedFields" : []
}
],
"lead": {
"firstName": "Mark",
"lastName": "Taylor",
"phone": "012-345-6789",
"email": "mtaylor@company.com",
"company": "Company1",
"extendedFields" : []
}
}
Sample Response
The API returns the service appointment ID and the assigned service resources.
{
"result" : {
"assignedResourceIds" : [ "0HnB0000000LVbfKAG" ],
"parentRecordId" : "00QB00000094lOZMAY",
"serviceAppointmentId" : "08pB0000000hvR1IAI"
}
}
Create a page to show confirmation when the service appointment creation is completed.
Here’s how a sample confirmation page can look.
