calendar-api
v1.3.0
Published
* [Calendars](#calendars) * [Availability](#availabilty) * [Swagger Docs](#swagger-docs) * [Postman](#postman)
Downloads
2
Readme
Calendar API
Calendars
Before availablility can be set, there must be a calendar created. The calendar contains the following object:
{
"calendarId": {{shortId}},
"calendarType": "NONE",
"sellMode": "NONE"
}
Validation
- calendarId is a required field, and must be a valid shortId
- calendarType is one of
['INVENTORY', 'CONFIRMATION_METHOD']
With a default ofINVENTORY
- sellMode is one of
[AVAILABLE', 'UNAVAILABLE', 'CALL_AND_REQUEST']
with a default ofUNAVAILABLE
Routes
{{host}} is https://portal-dev.leisurelink.com or https://portal.leisurelink.com
Healthcheck
{{host}}/calendar-api/v1/healthcheck
Sample Response (200):
{ "version": "calendar-api 1.0.3", "Inventory Round Trip": "0s 28.389224ms", "Calendar Round Trip": "0s 28.722085ms" }
Create Calendar
There are two ways to create a Calendar, with the preferred way to be with a PUT. The PUT will overwrite any previous data, where the POST will return a 409
if there is already a calendar object created with the supplied Id.
{{host}}/calendar-api/v1/en-US/calendars/{{calendarId}}
Sample Request:
{ "calendarType": "INVENTORY", "sellMode": "UNAVAILABLE" }
Responses:
400
- For errors.200
- For a success
{{host}}/calendar-api/v1/en-US/calendars
Sample Request:
{ "calendarId": {{shortId}}, "calendarType": "INVENTORY", "sellMode": "UNAVAILABLE" }
Responses:
409
- Is returned if the calendar already exists200
- For a success
Get Calendar
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}
- Responses:
404
- If the calendarId does not exits200
- For a success
Patch Calendar
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}
- Responses:
404
- If the calendarId does not exits200
- For a success
Delete Calendar
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}
- Responses:
404
- If the calendarId does not exits204
- For a success
Availability
Get Available Count
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability-check?begin=2016-03-11&end=2016-03-20
- Responses:
404
- If the calendarId does not exist400
- Validation Errors200
- Success{ available: 0 }
Note - This returns the Math.Max across all days in the range. If there is no availability for a day in the range, the available will be returned as 0.
Get Availability By Day
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability/{date}
- Responses:
404
- If the calendarId does not exits400
- Validation Errors200
- For a success{ "sold": 0, "allocated": 6, "date": "2016-01-03", "available": 6 }
Note - If there is not availability for the given calendar/date combo, a default availability object will be returned. The default availability will have the allocated as
null
Get Availability By Date Range
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability?begin={begin}&end={end}
- Responses:
404
- If the calendarId does not exits400
- Validation Errors200
- For a success[ { "sold": 0, "allocated": 6, "date": "2016-01-01", "available": 6 }, { "sold": 0, "allocated": 6, "date": "2016-01-03", "available": 6 } ]
Note - If there is not availability for the given calendar/date combo, a default availability object will be returned. The default availability will have the allocated as
null
Put Availability By Day
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability/{date}
Request Body:
{ "allocated": 6 }
Responses:
404
- If the calendarId does not exits400
- Validation errors.200
- For a success{ "sold": 0, "allocated": 6, "date": "2016-01-03", "available": 6 }
Put Availability
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability
Request Body:
[ { "date": "2016-03-11", "allocated": 4 }, { "date": "2016-03-12", "allocated": 4 } ]
Responses:
404
- If the calendarId does not exits400
- Validation Errors400
- Duplicate Days200
- For a success[ { "sold": 0, "allocated": 6, "date": "2016-01-01", "available": 6 }, { "sold": 0, "allocated": 6, "date": "2016-01-03", "available": 6 } ]
Patch Availability by Ranges
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability
Request Body:
[ { "begin": "2016-03-11", "end": "2016-03-20", "availability": { "allocated": 2 } }, { "begin": "2016-03-24", "end": "2016-03-30", "availability": { "allocated": 3 } } ]
Responses:
404
- If the calendarId does not exits400
- Validation Errors400
- Duplicate Days200
- For a success[ { "sold": 0, "allocated": 6, "date": "2016-01-01", "available": 6 }, { "sold": 0, "allocated": 6, "date": "2016-01-03", "available": 6 } ]
Delete Availability By Day
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability/{date}
- Responses:
404
- If the calendarId does not exits400
- Validation Errors.204
- For a success
Delete Availability By Date Range
{{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability?begin={begin}&end={end}
- Responses:
404
- If the calendarId does not exits400
- Validation Errors204
- For a success
Swagger Docs
Postman
In the Leisurelink Postman library (you must be invited) there is a collection called calendar-api