[FEATURE] Joomla Web Service API (com_api plugin) #29

Open
opened 2026-05-24 03:23:40 +00:00 by jmiller · 0 comments
Owner

Feature Description

Add a Joomla Web Services API plugin to expose this extension's data via REST endpoints, following Joomla 4/5's built-in API application.

Problem or Use Case

Joomla 4+ includes a headless API application at /api/. Extensions that register web service plugins can expose CRUD endpoints for their data, enabling:

  • Headless/decoupled frontend integrations
  • Mobile app backends
  • Third-party system integrations (CRM, ERP, CI/CD)
  • Automated content management and monitoring

Proposed Solution

Create a plg_webservices_<extension> plugin that:

  1. Registers API routes in onBeforeApiRoute event
  2. Exposes RESTful endpoints (GET list, GET item, POST, PATCH, DELETE)
  3. Uses Joomla's built-in API authentication (token or basic auth)
  4. Returns JSON:API formatted responses

Standard Endpoints

  • GET /api/index.php/v1/<resource> - List items
  • GET /api/index.php/v1/<resource>/:id - Get single item
  • POST /api/index.php/v1/<resource> - Create item
  • PATCH /api/index.php/v1/<resource>/:id - Update item
  • DELETE /api/index.php/v1/<resource>/:id - Delete item

Implementation Details

  • New plugin: plg_webservices_<name>
  • Namespace: Joomla\Plugin\WebServices\<Name>
  • Router class extending Joomla\CMS\Router\ApiRouter
  • JSON:API serialization via Joomla's built-in JsonApiView
  • API fields should match the extension's database schema
  • Requires Joomla 4.0+ API application enabled

References

## Feature Description Add a Joomla Web Services API plugin to expose this extension's data via REST endpoints, following Joomla 4/5's built-in API application. ## Problem or Use Case Joomla 4+ includes a headless API application at /api/. Extensions that register web service plugins can expose CRUD endpoints for their data, enabling: - Headless/decoupled frontend integrations - Mobile app backends - Third-party system integrations (CRM, ERP, CI/CD) - Automated content management and monitoring ## Proposed Solution Create a `plg_webservices_<extension>` plugin that: 1. Registers API routes in `onBeforeApiRoute` event 2. Exposes RESTful endpoints (GET list, GET item, POST, PATCH, DELETE) 3. Uses Joomla's built-in API authentication (token or basic auth) 4. Returns JSON:API formatted responses ### Standard Endpoints - `GET /api/index.php/v1/<resource>` - List items - `GET /api/index.php/v1/<resource>/:id` - Get single item - `POST /api/index.php/v1/<resource>` - Create item - `PATCH /api/index.php/v1/<resource>/:id` - Update item - `DELETE /api/index.php/v1/<resource>/:id` - Delete item ## Implementation Details - New plugin: `plg_webservices_<name>` - Namespace: `Joomla\Plugin\WebServices\<Name>` - Router class extending `Joomla\CMS\Router\ApiRouter` - JSON:API serialization via Joomla's built-in `JsonApiView` - API fields should match the extension's database schema - Requires Joomla 4.0+ API application enabled ## References - [Joomla Web Services API docs](https://manual.joomla.org/docs/general-concepts/web-services-api/) - Core examples: `plg_webservices_content`, `plg_webservices_menus`
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoWaaS#29