Change Appointment Time

A time slot represents a period in a day when an appointment can be scheduled.

  1. Create a page to show the available time slots for the resource associated with the appointment.

  2. Make a POST request on the getAppointmentSlots REST API by passing the required workTypeGroupId or workTypeId parameter along with the .territoryId parameter.

    Resource URI

    https://yourInstance.salesforce.com/services/data/v68.0/scheduling/getAppointmentSlots
    

    Sample Request

    Using the WorkTypeId parameter.

    {
      "workType": {
        "id": "08qS70000004DQsIAM"
      },
      "territoryIds": [
        "0HhS700000001DYKAY"
      ],
      "requiredResourceIds": [
        "0HnS700000002jAKAQ"
      ],
      "accountId": "001S7000001pFlJIAU",
      "schedulingPolicyId": "2F0VrRM0000004CUV",
      "engagementChannelTypeIds": [
        "0eFS70000004CGFMA2"
      ]
    }
    

    Using the WorkTypeGroupId parameter.

    {
      "workTypeGroupId": "0VS2x0000008ZotGAE",
      "accountId": "001S7000001pFlJIAU",
      "schedulingPolicyId": "2F0VrRM0000004CUV",
      "territoryIds": [
        "0HhS700000001DYKAY"
      ],
      "requiredResourceIds": [
        "0HnS700000002jAKAQ"
      ],
      "engagementChannelTypeIds": [
        "0eFS70000004CGFMA2"
      ]
    }
    

    Sample Response

    The API returns the available time slots for a resource.

    {
      "timeSlots" : [ {
        "endTime" : "2023-03-26T17:55:00.000+0000",
        "remainingAppointments" : 1,
        "startTime" : "2023-03-26T17:30:00.000+0000",
        "territoryId" : "0HhS700000001DYKAY"
      }, {
        "endTime" : "2023-03-30T16:55:00.000+0000",
        "remainingAppointments" : 1,
        "startTime" : "2023-03-30T16:30:00.000+0000",
        "territoryId" : "0HhS700000001DYKAY"
      }, {
        "endTime" : "2023-04-02T16:55:00.000+0000",
        "remainingAppointments" : 1,
        "startTime" : "2023-04-02T16:30:00.000+0000",
        "territoryId" : "0HhS700000001DYKAY"
      }, {
        "endTime" : "2023-04-04T18:25:00.000+0000",
        "remainingAppointments" : 1,
        "startTime" : "2023-04-04T18:00:00.000+0000",
        "territoryId" : "0HhS700000001DYKAY"
      } ]
    }
    
  3. Parse the JSON response, and show the available time slots on the page.

Your users can select a time slot for the appointment from the page.