The MDJM REST API includes a number of endpoints and methods allowing you to access data;
- event (GET/POST)
For accessing a specific events information. More details - events (GET/POST)
For accessing information for multiple events - employee (GET/POST)
For retrieving a specific employees information. More details - client (GET/POST)
For retrieving a specific clients information. More details - availability (GET)
For performing availability checks. More details
Endpoints are used like so;
http://<yoursite.com>/wp-json/mdjm/v1/<endpoint>
An example of the events endpoint would therefore be;
http://yoursite.com/wp-json/mdjm/v1/events/
and when combined with your API Key and Token;
http://yoursite.com/wp-json/mdjm/v1/events/?api_key=03e8d350690c06b6106edc7936bd2b96&token=b35b7c30f56e2975dcc7dc171db90cdb
Visibility
All endpoints with the exception of availability require the API key and token. Availability checks are intended to be public and therefore no authentication is required.
Responses
All API responses are provided in JSON format. An example response for an API request to the event endpoint would look like;
{ "data": { "request": { "request": "Retrieve Event", "params": {} }, "event": { "id": 5818, "client": "62", "contract": "7955", "contract_status": "Signed", "cost": { "balance": 0, "balance_status": "Paid", "deposit": "47.50", "deposit_status": "Paid", "remaining_deposit": "0", "cost": "475.00" }, "date": "2016-11-30", "duration": "6 hours", "employees": { "employees": { "1": { "role_slug": "dj", "role": "DJ", "wage": "100.00", "payment_status": { "payment_status": "part-paid", "payment_date": "2016-05-17 16:27:00", "payment_txn": 8043, "payment_amount": "0.00", "txn_id": 0 }, "93": { "role_slug": "mdjm-photographer", "role": "Photographer", "wage": "75", "payment_status": "paid", "txn_id": "" } }, "primary_employee": "1" }, "end_date": "2016-12-01", "end_time": "01:00:00", "equipment": { "package": "Standard Disco", "addons": "White Setup<br />Photobooth" }, "name": "40th Birthday Party", "playlist": { "playlist_enabled": true, "playlist_guest_code": "5dw2Z9cHy", "playlist_status": true }, "setup_date": "2016-11-30", "setup_time": "01:00:00", "source": "Google", "status": "Completed", "start_time": "19:00:00", "type": "Child Birthday Party", "venue": { "id": "8691", "name": "Client Address", "address": [ "Address Line 1", "Address Line 2", "London", "County", "AB1 2CD" ], "contact": "Jonathan King", "details": [ "Low Ceiling", "PAT Required", "PLI Required", "Via Stairs" ], "email": "[email protected]", "phone": "0123456789", "notes": "" } } }, "headers": { "Content-type": "application/json" }, "status": 200 }
Error Checking
If your API call results in an error, the response will include an error message such as;
{ "data": { "error": "Event does not exist." }, "headers": { "Content-type": "application/json" }, "status": 200 }