menu_book Navigation menu

Endpoints Reference

Overview

Pragma CMS organizes its API endpoints into specialized files located in the /api directory. Access to these endpoints is restricted by the user's session and specific permissions, with the exception of the /api/content directory which is optimized for headless consumption.

1. Content & Search (Public / Headless)

These endpoints are designed for high-performance data retrieval for external applications.

/api/content/index.php

The primary entry point for headless data. It retrieves entries and pages with their translations and media.

  • Actions: list (collections), single (by slug or ID).
  • Note: Automatically decodes Page Builder JSON blocks.

/api/content/search.php

A polymorphic search engine.

  • Actions: search (global search across all types), link_data (resolves internal "link recipes" into display titles and URLs).

2. Content Management

These endpoints are typically used by the Admin UI for CRUD operations and selectors.

/api/entries.php

Handles dynamic content entries (Articles, Products, etc.).

  • Actions: search (for relationship fields), get-children (hierarchical entries), get-entry (returns raw data + generated admin HTML fields).

/api/pages.php

Specifically handles static and builder-based pages.

  • Actions: search, get-children, page-id (returns full page data + custom fields).

/api/forms.php

Manages the Form Builder infrastructure.

  • Actions: get-form-data, render-form-html, render-preview (real-time builder preview), list (for Editor.js blocks).

3. Taxonomies & Classification

/api/taxonomies.php

Retrieves metadata about the taxonomy structures themselves.

  • Purpose: Used to identify which taxonomies are available for a specific content type.

/api/taxonomies_terms.php

Handles the actual terms (Categories, Tags) within a taxonomy.

  • Methods: GET (list flat or hierarchy), POST (create terms on-the-fly with CSRF protection).

4. Media & Navigation

/api/media.php

Deep integration with the Media Manager.

  • Actions: media-id (returns dimensions, paths, and generated WebP/AVIF variants), unique-dates (used for the library's chronological filters).

/api/menu_items.php

Handles the data behind the Navigation Builder.

  • Actions: get-children (lazy-loading for large trees), search, menu-item-id.

5. System & Developer Tools

/api/routes.php

Exposes the internal routing table.

  • Purpose: Allows the Admin UI to verify URL pattern collisions and retrieve route-to-file mappings.

/api/templates.php

Interacts with the filesystem's template directory.

  • Actions: get-templates (lists available .php or .twig files in core/site/theme), get-template-code (retrieves raw file content for the code editor, protected by strict directory traversal security).

Global Parameter Reference

Most endpoints support the following query parameters to refine results:

ParameterTypeDescription
lang-idintFilters content by the specified language ID.
actionstringDefines the specific operation to perform within the endpoint.
searchstringTriggers a database search (min. 2 characters).
limitintLimits the number of results (Default: 10, Max: 50).
pageintUsed for paginating through large result sets.
lock
Security Note
All endpoints except those in /api/content/ require a valid session cookie. Endpoints involving POST, PUT, or DELETE methods also require a valid X-CSRF-TOKEN header.