⇣ GET /availability
The /availability request will be made as a GET request to your callback_url for example: GET https://api.example.com/cc/callbacks/availability.
If the product is freesale, availability will only return whether tickets are available or not, freesale products cannot return availability capacity. Alternatively, if you have a supplier setup then the availability query will defer to them instead.
The request will be made as a GET request, with the following as URL parameters:
| Parameter | Description | Example |
|---|---|---|
agent | The agent account email or domain that originated the availability request. You can use this value to vary availability per agent. | viator.com |
product | The product code | WINETOURS |
option | The option code (if applicable) | WITHLUNCH |
from | The start date of the query, inclusive. Given in the format YYYY-MM-DD | 2017-10-01 |
to | The end date of the query, inclusive. Given in the format YYYY-MM-DD | 2017-10-04 |
You must iterate over each day between the value of from and to (include).
Your response must be a JSON object, with the key being the date, and the value being either a list of time slots, or the availability for that specific date. For example:
{
"2017-10-01": {
"hours": {
"10:30": "12:30",
"14:00": "18:30"
},
"availability": {
"open": true,
"vacancies": null,
"tickets": {
"adult": "18+ years",
"child": "18 or under"
}
},
"pickups": {
"Tour Office & Travel Depot": {
"address": "81 Long Street",
"latitude": 33.9249,
"longitude": 18.4241,
"time": "10:30"
},
"Camps Bay - Beach Road": {
"address": "Opposite the Bay Hotel",
"latitude": 33.9249,
"longitude": 18.4241,
"time": "11:30"
}
}
},
"2017-10-02": {
"times": {
"10:30": {
"open": true,
"vacancies": 12,
"tickets": {
"adult": "18+ years",
"child": "18 or under"
},
"pickups": {
"Tour Office & Travel Depot": {
"address": "81 Long Street",
"latitude": 33.9249,
"longitude": 18.4241,
"time": "09:30"
},
"Camps Bay - Beach Road": {
"address": "Opposite the Bay Hotel",
"latitude": 33.9249,
"longitude": 18.4241,
"time": "10:00"
}
}
},
"11:00": {
"open": false,
"vacancies": 0,
"tickets": {
"adult": "18+ years",
"child": "18 or under"
},
"pickups": []
}
]
},
"2017-10-03": {
"times": {
"10:30": {
"open": false,
"vacancies": null,
"tickets": {
"adult": "18+ years",
"child": "18 or under"
},
"pickups": []
},
"11:00": {
"open": true,
"vacancies": 12,
"tickets": {
"adult": "18+ years",
"child": "18 or under"
},
"pickups": []
}
]
},
"2017-10-04": {
"hours": {
"10:30": "18:30"
},
"availability": {
"open": false,
"vacancies": null,
"tickets": {
"adult": "18+ years",
"child": "18 or under"
}
},
"pickups": []
},
"2017-10-05": {
"hours": {
"10:30": "12:30",
"14:00": "18:30"
},
"availability": {
"open": true,
"vacancies": 25,
"tickets": {
"adult": "18+ years",
"child": "18 or under"
}
},
"pickups": []
}
}
The key represents the date, and the value will contain either hours (opening hours) and availability, or a list of times. The former represents allows agents to purchase tickets for the whole day (if available), and the latter forces agents to purchase for a specific time slot.
For each there is an availability object, that will always and only have two fields open and vacancies. A complete reference guide of all these fields is given below:
Note you cannot mix dates with both
timesANDhours, you must chose one or the other.
| Field | Description |
|---|---|
times[*] | Time slots available for purchase, the key is given in the format HH:MM (24hr clock) in the product's local time zone. |
times[*][open]availability[open] | A boolean value indicating whether tickets can be purchased or not. |
times[*][vacancies]availability[vacancies] | How many tickets can be purchased. |
times[*][tickets][*]availability[tickets][*] | An object where the key is the ticket type available for sale, and the value are the conditions the customer must comply with to be suitable for that type of ticket. The ticket types must be one of the following: - adult - youth - child - infant - senior - student |
hours[*] | An object of times the venue opens (key) and closes (value). The venue can have multiple opening times. |
times[*][pickups][*]pickups[*] | The key is the name of the pickup, this is what will be included in the booking confirmation request. |
times[*][pickups][*][address]pickups[*][address] | Either an address or simple instructions of how to get to the pickup location. |
times[*][pickups][*][latitude]pickups[*][latitude] | The exact latitude of the pickup point |
times[*][pickups][*][longitude]pickups[*][longitude] | The exact longitude of the pickup point |
times[*][pickups][*][time]pickups[*][time] | The time the customer should be at the pickup location to be collected. |
If availability is open, but vacancies is 0 the availability should be considered sold out. If availability is closed (open = false) but there are still vacancies then the product should be considered blocked out, or closed on those days, rather than sold out.
Updated about 8 years ago
