Booking API Reference
Last modified with commit 4551e16 on
by Martin Jagodic.
The Booking API (Azure Functions) handles all dynamic booking operations including cart management, checkout, payment processing, and order placement.
For static program catalog data (build-time only), see the Programs Index API.
Overview
The Booking API provides endpoints for:
- Cart operations - Add/remove services and cross-sale products
- Checkout - Calculate totals, fees, taxes, and installments
- Coupons - Add and remove discount codes
- Orders & Payments - Place orders and handle payment initialization
- Data lookups - Get packages, products, accommodation, and cross-sale items
All endpoints require programId (and often bookingId or serviceId) to operate on specific program bookings.
Base URLs
- Main repository: https://github.com/poslovnimediji/cmt-booking/, api directory
- Production (Azure): https://cmt-booking.azurewebsites.net/api/
- Development (Azure): https://cmt-booking-develop.azurewebsites.net/api/
- Local: http://localhost:7071/api/
Authentication
All endpoints are configured with anonymous access (auth_level=ANONYMOUS). If an external gateway enforces auth, that is outside this codebase.
Content Type
- Request bodies are JSON (
application/json) forPOSTendpoints. - Most responses are JSON with a shared envelope (see below).
Response Envelope
Most endpoints return:
{
"success": true,
"data": <payload>
}
On error (500):
{
"success": false,
"error": "<message>"
}
Notes:
GET /sync-allreturns a plain text response ("sync successful") and does not use the JSON envelope.- Some response payloads are passed through from Salesforce
retdataand are not fully described here.
Endpoint Index
| Method | Path | Purpose |
|---|---|---|
| GET | /keep-warm | Health keep-warm ping |
| GET | /sync-all | Force cache sync |
| GET | /packages | List available packages |
| GET | /products | Get cached products for a program element |
| GET | /accommodation | Get cached accommodation + units |
| GET | /cross-sale | Get cached cross-sale products |
| DELETE | /cart | Empty cart in Salesforce |
| POST | /cart/main | Add main service to cart |
| POST | /cart/cross-sale | Add cross-sale service to cart |
| DELETE | /cart/cross-sale | Remove cross-sale service from cart |
| GET | /checkout | Proceed to checkout (fees, totals) |
| POST | /coupon | Add coupon |
| DELETE | /coupon | Remove coupon |
| POST | /order | Place order + handle payment |
Endpoints
GET /keep-warm
Returns a successful response with an empty array.
Response data:
[]
GET /sync-all
Forces cache refresh of active programs.
Response:
- Plain text
"sync successful"(not JSON).
GET /packages
Lists packages for a program and date range. Proxies to Salesforce checkavailability.
Query parameters:
programId(string, required)channelId(string, required)arrival(string, required) - start datedeparture(string, required) - end date
Response data:
- Array of packages (
retdata.wpackagesfrom Salesforce).
GET /products
Returns cached products for a program element.
Query parameters:
programId(string, required)programElement(string, required)
Response data:
- Array of products (cached JSON), or empty array if not found.
GET /accommodation
Returns cached accommodation details plus computed units for the date range.
Query parameters:
programId(string, required)programElement(string, required)accommodationSlug(string, required)arrival(string, optional) - defaults to programdefaultArrivalDatedeparture(string, optional) - defaults to programdefaultDepartureDate
Response data:
- Accommodation object from cache with added
unitsfield.
GET /cross-sale
Returns cached cross-sale products for a program element and package.
Query parameters:
programId(string, required)programElement(string, required)packageId(string, required)
Response data:
- Array of products (base + extension) from cache.
DELETE /cart
Empties the cart in Salesforce for a booking.
Query parameters:
bookingId(string, required)programId(string, required)
Response data:
null
POST /cart/main
Adds a main service to the cart.
Request body:
programId(string, required)serviceId(string, required)arrival(string, required)departure(string, required)guests(number, required)quantity(number, required)bookingId(string, optional)timeSlotId(string, optional)extras(array, optional)- Each item:
serviceId(string, required)timeSlotId(string, required)
- Each item:
Response data:
bookingId(string)total(number)bookingServices(array) - Salesforceretdata.wmservices
POST /cart/cross-sale
Adds a cross-sale service to the cart.
Request body:
programId(string, required)bookingId(string, required)serviceId(string, required)timeSlotId(string, required)guests(number, required)
Response data:
bookingServiceId(string)total(number)
DELETE /cart/cross-sale
Removes a cross-sale service from the cart.
Query parameters:
bookingServiceId(string, required)bookingId(string, required)programId(string, required)
Response data:
total(number)
GET /checkout
Proceeds to checkout and returns totals, fees, installments, and coupons.
Query parameters:
bookingId(string, required)programId(string, required)paymentType(string, optional) - defaults toBank transfercardType(string, optional) - used whenpaymentTypeis a cardinsurance(string, optional) -trueorfalse(defaultfalse)
Response data:
total(number)bookingFee(number)serviceFee(number)touristTax(number)installments(array)insurancePrice(number)coupons(array)debug(object) - raw Salesforceretdata
POST /coupon
Adds a coupon to the booking.
Request body:
programId(string, required)couponCode(string, required)bookingId(string, required)
Response data:
{}
DELETE /coupon
Removes a coupon from the booking.
Query parameters:
programId(string, required)bookingId(string, required)couponCode(string, required)
Response data:
{}
POST /order
Places an order and handles payment initialization or finalization. When paymentMethod is not Bank transfer, this flow may return a payment URL for the next step.
Request body:
orderData(object, required) - Salesforce payload for placing orderpaymentMethod(string, required) -Bank transfer,creditcard, or other supported valuespaymentToken(string, optional) - returned from Saferpay initializationbookingNumber(string, optional) - required when continuing a paymentinstallmentId(string, optional) - required when continuing a paymentinstallmentAmount(number, optional) - required for card/PayPal flowcardType(string, optional) - required forcreditcardreturnUrl(string, optional) - used for payment redirectlocale(string, optional) - used for payment page
Response data (one of):
bookingNumber(string) - when order is finalized or bank transferbookingNumber,installmentId,paymentToken,paymentUrl- when payment page is initialized
Known Gaps
Some field types and allowed enum values are defined by upstream Salesforce or Saferpay APIs and are not validated in this app. If you need strict schemas, confirm the upstream contracts for retdata shapes and supported paymentMethod or cardType values.