LeadSquared Developer Centre

ON THIS PAGE

Get Available Slots of Users by Email Address


Lets you retrieve availability slots for multiple users by passing their email addresses.

  • Pass a “FromDate” and “ToDate” within which you want to retrieve user availability slots. The difference between the from and to date cannot be more than 100 days.
  • Pass one or more user email addresses in the “Users” parameter.
  • If you want to retrieve slots that have conflicting tasks, pass the “IncludeAllowedConflictSlots” parameter as true. Otherwise pass it as false.

The API response returns –

  • Available slots, break timings, busy slots* and workday template timezone for each user.
  • A “NoSlotsReason” parameter as either “Holiday”, “Leave”“NotScheduled” or “WorkDayTemplateNotDefined”.

* Note that users can create multiple tasks at the same time. The API returns slot as busy if and only if the task type of the task in the conflicting slot has the “Allow Conflicts” setting is set to false.

API URL

URL
Icon
POST https://{host}/v2/Task.svc/RetrieveAvailableSlots/ByUserEmailAddress?accessKey=AccessKey&secretKey=SecretKey

Request

Content-Type: application/json
JSON Body/Payload Icon
{
  "FromDate": "2018-08-25",
  "ToDate": "2018-09-25",
  "Users": [
    "bobdoe@gmail.com",
    "jackdoes@gmail.com"
  ],
  "IncludeAllowedConflictSlots": false,
  "Paging": {
    "PageIndex": 1,
    "PageSize": 100
  }
}

Request Parameters

Parameter Description
FromDate

Starting date to retrieve user availability slots from.

ToDate

End date to retrieve user availability slots till.

Users

You can pass multiple user email addresses here.

IncludeAllowedConflictSlots

Pass true to include availability slots with conflicting appointments. Pass false to exclude conflicting appointment slots.

Paging

Use “PageIndex” to specify the number of pages to return and “PageSize” to indicate the number of records you want returned per page.

Response

200 OK
Content-Type: application/json
{
  "RecordCount": 2,
  "List": [
    {
      "Date": "2018-09-25",
      "UserSlots": [
        {
          "UserId": "477aec30-bfee-11e8-a43f-02742c1c8abe",
          "EmailAddress": "zoo@lsqdev.in",
          "UserTimeZone": "Asia/Kolkata",
          "AvailableSlots": [
            {
              "StartTime": "22:15:00",
              "EndTime": "00:00:00"
            }
          ],
          "Breaks": [
            {
              "StartTime": "22:15:00",
              "EndTime": "22:30:00"
            }
          ],
          "BusySlots": [
            {
              "StartTime": "2018-09-25 06:00:00",
              "EndTime": "2018-09-25 06:30:00"
            },
            {
              "StartTime": "2018-09-25 06:30:00",
              "EndTime": "2018-09-25 07:00:00"
            },
            {
              "StartTime": "2018-09-25 06:30:00",
              "EndTime": "2018-09-25 07:00:00"
            }
          ],
          "WorkDayTemplateTimeZone": "Pacific/Tongatapu",
          "NoSlotsReason": null
        },
        {
          "UserId": "8371b49f-a465-11e8-aa96-0258598489d8",
          "EmailAddress": "Bhargavi.tasknew14@mailinator.com",
          "UserTimeZone": "Asia/Kolkata",
          "AvailableSlots": null,
          "Breaks": null,
          "BusySlots": [
            {
              "StartTime": "2018-09-25 06:30:00",
              "EndTime": "2018-09-25 07:00:00"
            },
            {
              "StartTime": "2018-09-25 06:30:00",
              "EndTime": "2018-09-25 07:00:00"
            }
          ],
          "WorkDayTemplateTimeZone": null,
          "NoSlotsReason": "WorkDayTemplateNotDefined"
        }
      ]
    }
  ]
}

HTTP Response Codes

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.

On this page

© 2022 by MarketXpander Services Pvt Ltd. All Rights Reserved.