# Create Service Appointments

The last step in the scheduling application is to show the service appointment details for the user to review and create the appointment.

A service appointment represents an appointment booked through Salesforce Scheduler.

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.

![A representation of the Review Service Appointment screen.](https://a.sfdcstatic.com/developer-website/sfdocs/service-cloud/media/salesforce-scheduler-dev-guide/uc9\_review_appointment_details.png)

1. Link the Next button to a POST request on the [`service-appointments`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_service_appointments.htm) Connect API to create the service appointment.

   **Resource URI**

   ```nolang
   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 `status` to `Scheduled` to indicate that the appointment is scheduled.

   ```nolang
   {
     "serviceAppointment": {
       "serviceTerritoryId": "0Hhx000000012oSCAQ",
       "parentRecordId": "001x0000005DLxpAAG",
       "workTypeId": "08qx000000014fnAAA",
       "schedStartTime": "2022-04-19T10:30:00.000+0000",
       "schedEndTime": "2022-04-19T10:40:00.000+0000",
       "additionalInformation": "Appointment Scheduling Custom App.",
       "appointmentType": "Testing Purpose",
       "extendedFields": [
         {
           "name": "status",
           "value": "Scheduled"
         }
       ]
     },
     "assignedResources": [
       {
         "serviceResourceId": "0Hnx000000006GcCAI",
         "isRequiredResource": "true"
       }
     ]
   }
   ```

   **Sample Response**

   The API returns the service appointment ID and the assigned service resources.

   ```nolang
   {
     "result": {
       "assignedResourceIds": [
         "03rx00000001uxJAAQ"
       ],
       "serviceAppointmentId": "08px00000001toRAAQ"
     }
   }
   ```

   **For a Guest User (Lead)**

   **Sample Request**

   Pass the required lead details in the input request body.

   Set `status` to `Scheduled` to indicate that the appointment is scheduled.

   ```nolang
   {
     "serviceAppointment": {
       "serviceTerritoryId": "0Hhx000000012oSCAQ",
       "workTypeId": "08qx000000014fnAAA",
       "schedStartTime": "2022-04-19T10:30:00.000+0000",
       "schedEndTime": "2022-04-19T10:40:00.000+0000",
       "additionalInformation": "Appointment Scheduling Custom App.",
       "appointmentType": "Testing Purpose",
       "extendedFields": [
         {
           "name": "status",
           "value": "Scheduled"
         }
       ]
     },
     "assignedResources": [
       {
         "serviceResourceId": "0Hnx000000006H4CAI",
         "isRequiredResource": "true"
       }
     ],
     "lead": {
       "email": "name@company.com",
       "firstName": "FName",
       "lastName": "LName",
       "company": "CompanyName"
     }
   }
   ```

   **Sample Response**

   The API returns the service appointment ID and the assigned service resources.

   ```nolang
   {
     "result": {
       "assignedResourceIds": [
         "03rx00000001uxOAAQ"
       ],
       "parentRecordId": "00Qx0000001cKPoEAM",
       "serviceAppointmentId": "08px00000001toWAAQ"
     }
   }
   ```

Create a page to show confirmation when the service appointment is created successfully.

Here’s how a sample confirmation page can look.

![A representation of the confirmation screen.](https://a.sfdcstatic.com/developer-website/sfdocs/service-cloud/media/salesforce-scheduler-dev-guide/screen_appointment_creation.png)
