Programs Index API (Netlify)
Last modified with commit d64c935 on
by Martin Jagodic.
The Programs Index API provides a static catalog of all programs and their elements.
For runtime booking operations, see the Booking API Reference.
Overview
The Programs Index API serves a cached, read-only JSON index of:
- All active programs with their metadata
- Program elements (accommodation types, packages, etc.) within each program
- Cross-sale product mappings
- Default booking dates and constraints
Base URLs
- Development/Staging: https://develop--cmt-booking.netlify.app/api/
- Repository: https://github.com/poslovnimediji/cmt-booking/, www directory (Netlify deployment)
Environment Variables
Set the following environment variables for the Hugo build:
# fetch program data
BOOKING_PROGRAMS_URL=https://develop--cmt-booking.netlify.app/api/programs/index.json
# Enable build-time product fetching from the Booking API (Azure Functions):
BOOKING_API_URL=https://cmt-booking-develop.azurewebsites.net/api/
Variables are loaded from .env during the build process (see bin/build.sh).
Endpoint: GET /api/programs/index.json
Description
Returns a complete index of all programs and their program elements. This is a static JSON file endpoint designed for build-time consumption.
Usage in Hugo
The Hugo build process fetches this endpoint via the layouts/partials/get-booking-programs.html partial:
- Hugo calls
resources.GetRemoteto fetch the URL - The response is unmarshaled into a data structure
- The data is cached using
partialCachedto avoid refetching - Individual program pages match their
programIdfront matter against this index - Program details are rendered directly into the HTML during build
Response
Content-Type: application/json
Format: Plain JSON array (not wrapped in success envelope)
Example Response:
[
{
"programId": "a1mQx000002frf7IAA",
"title": "@bw - Balkan Wave 2026",
"link": "/balkan-wave2026/",
"channelId": "p8fdirzhf7cu8qbzdqo6x4qda5nxzant",
"defaultGuests": 2,
"maxGuests": 12,
"unitSelection": "auto",
"defaultArrivalDate": "2026-07-09",
"defaultDepartureDate": "2026-07-12",
"lockDates": true,
"minArrivalDate": "2026-07-05",
"maxDepartureDate": "2026-07-12",
"bookingFeeName": "Booking fee",
"touristTaxName": "Tourist tax:",
"programElements": [
{
"slug": "3_night_packages",
"title": "3-DAY PACKAGES",
"type": "Accommodation services",
"subtype": ["apartments"],
"icon": "bed",
"crossSale": ["a1nQx00000fLLUyIAO", "a1nQx00000fLH9fIAG"]
},
{
"slug": "4_night_packages",
"title": "4-DAY PACKAGES",
"type": "Accommodation services",
"subtype": ["hotels"],
"icon": "bed",
"crossSale": ["a1nQx00000fLLUyIAO", "a1nQx00000fLH9fIAG", "a1nQx00000fL7dFIAS"]
},
{
"slug": "7_night_packages",
"title": "7-DAY PACKAGES",
"type": "Accommodation services",
"subtype": ["hotels"],
"icon": "bed",
"crossSale": ["a1nQx00000fLLUyIAO", "a1nQx00000fLH9fIAG", "a1nQx00000fL7dFIAS", "a1nQx00000fLOFpIAO"]
}
]
}
]
Response Fields
Program Object
| Field | Type | Description |
|---|---|---|
programId | string | Unique program identifier (Salesforce ID) |
title | string | Program title |
link | string | Booking app URL path (e.g., /balkan-wave2026/) |
channelId | string | Salesforce channel identifier |
defaultGuests | number | Default number of guests for booking |
maxGuests | number | Maximum guests allowed |
unitSelection | string | Unit selection strategy (auto, manual, etc.) |
defaultArrivalDate | string | Default arrival date (YYYY-MM-DD format) |
defaultDepartureDate | string | Default departure date (YYYY-MM-DD format) |
lockDates | boolean | Whether dates are locked (user cannot change) |
minArrivalDate | string | Earliest allowed arrival date |
maxDepartureDate | string | Latest allowed departure date |
bookingFeeName | string | Label for booking fee (e.g., “Booking fee”) |
touristTaxName | string | Label for tourist tax (e.g., “Tourist tax:”) |
programElements | array | Array of program element objects |
Program Element Object
| Field | Type | Description |
|---|---|---|
slug | string | URL-safe identifier for the element (e.g., 3_night_packages, 4_night_packages) |
title | string | Display title (e.g., 3-DAY PACKAGES, 4-DAY PACKAGES) |
type | string | Category type (e.g., Accommodation services, Activities) |
subtype | array | Subcategory types (e.g., ["apartments"], ["hotels"], ["tours"]) |
icon | string | Icon identifier (e.g., bed, utensils, camera) |
crossSale | array | Array of cross-sale product IDs (Salesforce IDs) |
Integration with cmt-sites
Program pages define their program ID in front matter:
---
title: Balkan Wave
programId: a1mQx000002frf7IAA
start_date: 2026-07-12T00:00:00Z
end_date: 2026-07-18T00:00:00Z
price: 145
---