Skip to main content

Availability

Once we have an event-type generated correctly we can check its availability. In colloquial language, we can say "check which slots are available"

In order to do that we can use the API endpoint getEventTypeAvailability passing the identifier (ID) of the event-type we want to check the availability of.

fetch("https://api.timetime.in/v1/event-types/{id}/availability", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});

This request returns among other fields one called timeSlots which contains an array of slots where the event-type could be available to be booked. The score parameter will have a positive value if it is available and a value of 0 if it is not available.

{
"timeSlots": [
{
"start": "2019-08-24T14:00:00Z",
"end": "2019-08-24T14:30:00Z",
"score": 1
},
{
"start": "2019-08-24T14:30:00Z",
"end": "2019-08-24T15:00:00Z",
"score": 0
}
]
}

In this case, we see an example in which the server returns two slots for the same day, the first one that lasts from 14:00 to 14:30 is available and the second one, from 14:30 to 15:00 is not available.