Show Calendar Availability

A time slot is a period in a day when an appointment can be scheduled. Use the getAppointmentSlots API to retrieve the calendar availability of the service resources associated with the appointment invitation.

Before making an API request to retrieve the invitation time slots, create a page on your website that shows the calendar availability of the service resources associated with the appointment invitation. The calendar availability is determined by the service territory ID, the work type group ID, and the service resource IDs that you obtained previously.

Ensure that the calendar shows only the available time slots for the selected resource between the shared invitation start and end dates.

Note

  1. To fetch the calendar availability for an appointment invitation, make a POST request on the getAppointmentSlots REST API.

    Resource URI

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

    Where YOUR_INSTANCE is a variable.

    Sample Request

    This sample calls the getAppointmentSlots API by passing the work type group ID, territory IDs, resource IDs, and invitation booking start and end dates.

    The workTypeGroupId field is required.

    Note

    1{
    2  "startTime": "2022-06-14T00:00:00.000Z",
    3  "endTime": "2022-06-30T00:00:00.000Z",
    4  "workTypeGroupId": "0VSx00000002Uh4GAE",
    5  "territoryIds": [
    6    "0Hhx00000002LzGCAU"
    7  ],
    8  "requiredResourceIds": [
    9    "0Hnx000000007d7CAA"
    10  ]
    11}

    Sample Response

    The request returns the calendar availability for the service resources associated with the invitation.

    1{
    2  "timeSlots": [
    3    {
    4      "endTime": "2022-06-14T02:15:00.000+0000",
    5      "remainingAppointments": 1,
    6      "startTime": "2022-06-14T01:15:00.000+0000",
    7      "territoryId": "0Hhx00000002LzGCAU"
    8    },
    9    {
    10      "endTime": "2022-06-14T02:30:00.000+0000",
    11      "remainingAppointments": 1,
    12      "startTime": "2022-06-14T01:30:00.000+0000",
    13      "territoryId": "0Hhx00000002LzGCAU"
    14    },
    15    {
    16      "endTime": "2022-06-14T12:30:00.000+0000",
    17      "remainingAppointments": 1,
    18      "startTime": "2022-06-14T11:30:00.000+0000",
    19      "territoryId": "0Hhx00000002LzGCAU"
    20    },
    21    {
    22      "endTime": "2022-06-14T12:45:00.000+0000",
    23      "remainingAppointments": 1,
    24      "startTime": "2022-06-14T11:45:00.000+0000",
    25      "territoryId": "0Hhx00000002LzGCAU"
    26    },
    27    {
    28      "endTime": "2022-06-15T02:15:00.000+0000",
    29      "remainingAppointments": 1,
    30      "startTime": "2022-06-15T01:15:00.000+0000",
    31      "territoryId": "0Hhx00000002LzGCAU"
    32    },
    33    {
    34      "endTime": "2022-06-15T02:30:00.000+0000",
    35      "remainingAppointments": 1,
    36      "startTime": "2022-06-15T01:30:00.000+0000",
    37      "territoryId": "0Hhx00000002LzGCAU"
    38    },
    39    {
    40      "endTime": "2022-06-15T12:30:00.000+0000",
    41      "remainingAppointments": 1,
    42      "startTime": "2022-06-15T11:30:00.000+0000",
    43      "territoryId": "0Hhx00000002LzGCAU"
    44    },
    45    {
    46      "endTime": "2022-06-15T12:45:00.000+0000",
    47      "remainingAppointments": 1,
    48      "startTime": "2022-06-15T11:45:00.000+0000",
    49      "territoryId": "0Hhx00000002LzGCAU"
    50    },
    51    {
    52      "endTime": "2022-06-16T01:45:00.000+0000",
    53      "remainingAppointments": 1,
    54      "startTime": "2022-06-16T00:45:00.000+0000",
    55      "territoryId": "0Hhx00000002LzGCAU"
    56    },
    57    {
    58      "endTime": "2022-06-16T02:00:00.000+0000",
    59      "remainingAppointments": 1,
    60      "startTime": "2022-06-16T01:00:00.000+0000",
    61      "territoryId": "0Hhx00000002LzGCAU"
    62    },
    63    {
    64      "endTime": "2022-06-17T12:30:00.000+0000",
    65      "remainingAppointments": 1,
    66      "startTime": "2022-06-17T11:30:00.000+0000",
    67      "territoryId": "0Hhx00000002LzGCAU"
    68    },
    69    {
    70      "endTime": "2022-06-17T12:45:00.000+0000",
    71      "remainingAppointments": 1,
    72      "startTime": "2022-06-17T11:45:00.000+0000",
    73      "territoryId": "0Hhx00000002LzGCAU"
    74    },
    75    {
    76      "endTime": "2022-06-18T01:45:00.000+0000",
    77      "remainingAppointments": 1,
    78      "startTime": "2022-06-18T00:45:00.000+0000",
    79      "territoryId": "0Hhx00000002LzGCAU"
    80    },
    81    {
    82      "endTime": "2022-06-18T02:00:00.000+0000",
    83      "remainingAppointments": 1,
    84      "startTime": "2022-06-18T01:00:00.000+0000",
    85      "territoryId": "0Hhx00000002LzGCAU"
    86    },
    87    {
    88      "endTime": "2022-06-20T02:15:00.000+0000",
    89      "remainingAppointments": 1,
    90      "startTime": "2022-06-20T01:15:00.000+0000",
    91      "territoryId": "0Hhx00000002LzGCAU"
    92    },
    93    {
    94      "endTime": "2022-06-21T03:15:00.000+0000",
    95      "remainingAppointments": 1,
    96      "startTime": "2022-06-21T02:15:00.000+0000",
    97      "territoryId": "0Hhx00000002LzGCAU"
    98    },
    99    {
    100      "endTime": "2022-06-21T03:30:00.000+0000",
    101      "remainingAppointments": 1,
    102      "startTime": "2022-06-21T02:30:00.000+0000",
    103      "territoryId": "0Hhx00000002LzGCAU"
    104    },
    105    {
    106      "endTime": "2022-06-25T07:45:00.000+0000",
    107      "remainingAppointments": 1,
    108      "startTime": "2022-06-25T06:45:00.000+0000",
    109      "territoryId": "0Hhx00000002LzGCAU"
    110    },
    111    {
    112      "endTime": "2022-06-27T12:30:00.000+0000",
    113      "remainingAppointments": 1,
    114      "startTime": "2022-06-27T11:30:00.000+0000",
    115      "territoryId": "0Hhx00000002LzGCAU"
    116    },
    117    {
    118      "endTime": "2022-06-27T12:45:00.000+0000",
    119      "remainingAppointments": 1,
    120      "startTime": "2022-06-27T11:45:00.000+0000",
    121      "territoryId": "0Hhx00000002LzGCAU"
    122    },
    123    {
    124      "endTime": "2022-06-28T02:15:00.000+0000",
    125      "remainingAppointments": 1,
    126      "startTime": "2022-06-28T01:15:00.000+0000",
    127      "territoryId": "0Hhx00000002LzGCAU"
    128    },
    129    {
    130      "endTime": "2022-06-28T02:30:00.000+0000",
    131      "remainingAppointments": 1,
    132      "startTime": "2022-06-28T01:30:00.000+0000",
    133      "territoryId": "0Hhx00000002LzGCAU"
    134    },
    135    {
    136      "endTime": "2022-06-28T02:45:00.000+0000",
    137      "remainingAppointments": 1,
    138      "startTime": "2022-06-28T01:45:00.000+0000",
    139      "territoryId": "0Hhx00000002LzGCAU"
    140    },
    141    {
    142      "endTime": "2022-06-29T12:15:00.000+0000",
    143      "remainingAppointments": 1,
    144      "startTime": "2022-06-29T11:15:00.000+0000",
    145      "territoryId": "0Hhx00000002LzGCAU"
    146    },
    147    {
    148      "endTime": "2022-06-29T12:30:00.000+0000",
    149      "remainingAppointments": 1,
    150      "startTime": "2022-06-29T11:30:00.000+0000",
    151      "territoryId": "0Hhx00000002LzGCAU"
    152    },
    153    {
    154      "endTime": "2022-06-29T12:45:00.000+0000",
    155      "remainingAppointments": 1,
    156      "startTime": "2022-06-29T11:45:00.000+0000",
    157      "territoryId": "0Hhx00000002LzGCAU"
    158    }
    159  ]
    160}
  2. Parse the response and show the time slots on your relevant website page so that users can choose an appointment time.

Create another page on your website to show the appointment details for users to review and book a selected appointment.