CMT Sites Documentation

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:

Base URLs

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:

  1. Hugo calls resources.GetRemote to fetch the URL
  2. The response is unmarshaled into a data structure
  3. The data is cached using partialCached to avoid refetching
  4. Individual program pages match their programId front matter against this index
  5. 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

FieldTypeDescription
programIdstringUnique program identifier (Salesforce ID)
titlestringProgram title
linkstringBooking app URL path (e.g., /balkan-wave2026/)
channelIdstringSalesforce channel identifier
defaultGuestsnumberDefault number of guests for booking
maxGuestsnumberMaximum guests allowed
unitSelectionstringUnit selection strategy (auto, manual, etc.)
defaultArrivalDatestringDefault arrival date (YYYY-MM-DD format)
defaultDepartureDatestringDefault departure date (YYYY-MM-DD format)
lockDatesbooleanWhether dates are locked (user cannot change)
minArrivalDatestringEarliest allowed arrival date
maxDepartureDatestringLatest allowed departure date
bookingFeeNamestringLabel for booking fee (e.g., “Booking fee”)
touristTaxNamestringLabel for tourist tax (e.g., “Tourist tax:”)
programElementsarrayArray of program element objects

Program Element Object

FieldTypeDescription
slugstringURL-safe identifier for the element (e.g., 3_night_packages, 4_night_packages)
titlestringDisplay title (e.g., 3-DAY PACKAGES, 4-DAY PACKAGES)
typestringCategory type (e.g., Accommodation services, Activities)
subtypearraySubcategory types (e.g., ["apartments"], ["hotels"], ["tours"])
iconstringIcon identifier (e.g., bed, utensils, camera)
crossSalearrayArray 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
---