The MDJM REST API includes the /availability/
endpoint to enable availability look ups to be performed.
The /availability/
endpoint allows you to query the events and availability database to determine if you are available on the given date.
Parameters
The /availability/
endpoint requires a single parameter to be sent along with the API request. There are also additional parameters than can optionally be provided;
date
(Required)
The date for which to perform the availability lookup. Should be provided in the format Y-m-d i.e. 2016-07-18employees
(Optional)
Comma separated list of employees to perform the lookup on. Default to allroles
(Optional)
Comma separated list of role slugs to perform the lookup on. Default to those set within MDJM -> Settings -> Client Zone -> Availability Settings
The following details will be returned;
date
(string)
The which was checkedresponse
(string)
available if the agency is available in the given date, or unavailableemployees
(string)
Comma separated list of employees who are available on the given datemessage
(string)
Relevant available/unavailable response as defined within MDJM->Settings->Client Zone Settings->Availability Checker
Method
The /availability/
endpoint accepts the GET HTTP method only.
The /availability/
endpoint requires no security validation and therefore it is not necessary to send the API key or Token with the request.
Example API Call
To retrieve availability information for 18th July, 2016 the following would be used;
1 |
http://<yoursite.com>/wp-json/mdjm/v1/availability/?date=2016-07-18 |
Response
The response from the above query would look like;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
{ "data": { "availability": { "date": "2016-07-19", "response": "available", "employees": [ 18, 1 ], "message": "Good news, we are available on the date you entered. Please contact us now" } }, "headers": { "Content-type": "application/json" }, "status": 200 } |
Rate this Article
We're working hard to ensure we provide you with useful and relevant documentation to help you get the most out of MDJM Event Management.
Please take a moment to let us know if you found this article helpful.