booking/session¶
While creating a booking, the details of the proposed booking are stored in an API session. This allows you to add multiple items to a booking, remove items and inform the server of your intent to book the item(s) in order to prevent over-bookings.
Each session call will return the session_id of the active session, and any attached session information. Your application must use the session_id in order to further modify the session or submit the booking beyond this point, and can pass it back to the API either as a cookie or a request parameter.
To start a new session, you simply pass in the booking SLIPs returned when from earlier “rated” inventory item queries.
-
POST/api/3.0/booking/session¶ Create or return information about and stored in the current server session. Once initiated, you can fetch the details of a proposed booking by accessing the session again with the session_id found in the response. The item details for the session will be returned with your request.
Form Parameters: - string session_id – The session ID to be loaded or written to. Can also be sent as a cookie.
- string/array slip – A SLIP, or multiple SLIPs to be added to a session. If need to add or remove more of the same item to a session, use alter below.
- array alter – Alterations to be made on the current session, based on the line_id of items in the session and actions to be taken. To change the qty of an item in the session, send an alter for the line_id of that item with the integer value you need to set (e.g alter[3]=5 sets item 3 to a qty of 5). To remove an item, use alter ‘remove’; and to opt-in or out of listed package items use ‘optin’ or ‘optout’ respectively.
-
GET/api/3.0/booking/session¶ Query Parameters: - session_id (string) – The session ID to read information from. Can also be sent as a cookie.
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 34 35 36 37 38 39 40 41 42 | {
"version": "3.0",
"account_id": 1,
"host_id": "your-company.checkfront.com",
"name": "Your Company",
"locale": {
"id": "en_US",
"lang": "_en",
"currency": "CAD"
},
"request": {
"status": "OK",
"resource": "booking",
"id": "session",
"method": "get",
"records": 0,
"limit": 0,
"page": 1,
"pages": 1,
"time": 0.0066
},
"booking": {
"session": {
"id": "ldpm9qlhgnrobja48vor9965p3",
"age": 0,
"item": {
"1": {
"sku": "overwaterbun",
"item_id": 17,
"name": "Overwater Room",
"date": {
"summary": "Tue Apr 8 2014 - Wed Apr 9 2014",
"start_date": "20140408",
"end_date": "20140409"
},
"slip": "17.20140408X2-guests.2",
"available": 2
}
}
}
}
}
|
-
POST/api/3.0/booking/session/clear¶
-
POST/api/3.0/booking/session/end¶ Query Parameters: - session_id (string) – The session ID to empty or close. Can also be sent as a cookie.