Get Appointment Time Slots

A time slot represents a period in a day when an appointment can be scheduled. Use the getAppointmentSlots REST API to fetch the available time slots for a resource.

  1. Create a page in your app to show the selected primary resource, other required resources, including assets, and the consolidated time slots for the primary service resource and required resources that users select.

    Here’s how a page can look.

    A representation of the manage multiple service resource screen.

  2. When the user selects one or more required resources, refresh the available time slots by making a POST request to the getAppointmentSlots REST API and passing the selected required resources along with the workTypeGroupId and territoryId parameters.

    Resource URI

    1https://yourInstance.salesforce.com/services/data/vXX.X/scheduling/getAppointmentSlots

    Sample Request

    1{
    2   "startTime" : "2023-11-30T09:00:00.000+0000",
    3   "endTime" : "2023-12-01T23:30:00.000+0000",
    4   "accountId" : "001S7000001pFlJIAU",
    5   "workTypeGroupId" : "0VSS700000000sVOAQ",
    6   "territoryIds" : ["0HhS700000001DYKAY"],
    7   "engagementChannelTypeIds": [
    8    "0eFS70000004CG5MAM"
    9   ],
    10   "primaryResourceId" : "0HnS700000002jAKAQ",
    11   "requiredResourceIds" : ["0HnS700000002jKKAQ"]
    12}

    Sample Response

    The API returns the time slots where the selected primary resource and required resources are available for the multi-resource appointment.

    1{
    2  "timeSlots": [
    3    {
    4      "endTime": "2023-11-30T18:00:00.000+0000",
    5      "engagementChannelTypeIds": [
    6        "0eFS70000004CG5MAM"
    7      ],
    8      "remainingAppointments": 1,
    9      "startTime": "2023-11-30T17:00:00.000+0000",
    10      "territoryId": "0HhS700000001DYKAY"
    11    },
    12    {
    13      "endTime": "2023-11-30T19:00:00.000+0000",
    14      "engagementChannelTypeIds": [
    15        "0eFS70000004CG5MAM"
    16      ],
    17      "remainingAppointments": 1,
    18      "startTime": "2023-11-30T18:00:00.000+0000",
    19      "territoryId": "0HhS700000001DYKAY"
    20    },
    21    {
    22      "endTime": "2023-11-30T20:00:00.000+0000",
    23      "engagementChannelTypeIds": [
    24        "0eFS70000004CG5MAM"
    25      ],
    26      "remainingAppointments": 1,
    27      "startTime": "2023-11-30T19:00:00.000+0000",
    28      "territoryId": "0HhS700000001DYKAY"
    29    },
    30    {
    31      "endTime": "2023-11-30T21:00:00.000+0000",
    32      "engagementChannelTypeIds": [
    33        "0eFS70000004CG5MAM"
    34      ],
    35      "remainingAppointments": 1,
    36      "startTime": "2023-11-30T20:00:00.000+0000",
    37      "territoryId": "0HhS700000001DYKAY"
    38    },
    39    {
    40      "endTime": "2023-11-30T22:00:00.000+0000",
    41      "engagementChannelTypeIds": [
    42        "0eFS70000004CG5MAM"
    43      ],
    44      "remainingAppointments": 1,
    45      "startTime": "2023-11-30T21:00:00.000+0000",
    46      "territoryId": "0HhS700000001DYKAY"
    47    },
    48    {
    49      "endTime": "2023-11-30T23:00:00.000+0000",
    50      "engagementChannelTypeIds": [
    51        "0eFS70000004CG5MAM"
    52      ],
    53      "remainingAppointments": 1,
    54      "startTime": "2023-11-30T22:00:00.000+0000",
    55      "territoryId": "0HhS700000001DYKAY"
    56    },
    57    {
    58      "endTime": "2023-12-01T00:00:00.000+0000",
    59      "engagementChannelTypeIds": [
    60        "0eFS70000004CG5MAM"
    61      ],
    62      "remainingAppointments": 1,
    63      "startTime": "2023-11-30T23:00:00.000+0000",
    64      "territoryId": "0HhS700000001DYKAY"
    65    },
    66    {
    67      "endTime": "2023-12-01T01:00:00.000+0000",
    68      "engagementChannelTypeIds": [
    69        "0eFS70000004CG5MAM"
    70      ],
    71      "remainingAppointments": 1,
    72      "startTime": "2023-12-01T00:00:00.000+0000",
    73      "territoryId": "0HhS700000001DYKAY"
    74    },
    75    {
    76      "endTime": "2023-12-01T02:00:00.000+0000",
    77      "engagementChannelTypeIds": [
    78        "0eFS70000004CG5MAM"
    79      ],
    80      "remainingAppointments": 1,
    81      "startTime": "2023-12-01T01:00:00.000+0000",
    82      "territoryId": "0HhS700000001DYKAY"
    83    }
    84  ]
    85}
  3. Parse the JSON response, and show the available time slots for the selected resources.

    Here’s how a Select Service Appointment Time page can look.

    A representation of the selected required resources screen.

    A multi-resource appointment can have a maximum of five required service resources: one primary required service resource plus four required service resources, including asset resources.

    Note

On the next page in your app, you can show the appointment details for the user to review and create the appointment.