he plg_content_swaggerui plugin is a documentation and testing utility for developers. It integrates Swagger UI—the industry-standard visual interface for REST APIs—directly into Joomla articles.
What this Plugin Does
Joomla 4 and 5 have a powerful built-in Web Services (REST API) layer. However, by default, exploring these APIs requires external tools like Postman or reading raw JSON code.
-
Swagger UI Embedding: It uses a shortcode or a specific trigger within a Joomla article to render the interactive Swagger UI dashboard.
-
API Schema Parsing: It points to an
openapi.jsonorswagger.jsonfile (often generated by Joomla's web services) and transforms it into a readable, clickable interface. -
Live Testing: It allows developers to "Try it out" directly from the Joomla frontend—sending real API requests to the site and seeing the responses (Headers, Status Codes, JSON body) in real-time.
How to Use the Plugin
1. Configuration
-
Install and enable the plugin via System > Manage > Plugins.
-
In the plugin settings, you may need to define the Default OpenAPI Spec URL. This is usually your Joomla API path (e.g.,
https://your-site.com/api/v1/openapi.json).
2. Displaying the UI
Depending on how the plugin is coded in your repository, you use it in one of two ways:
-
Automatic: Create a menu item or article with a specific alias (e.g., "api-docs").
-
Shortcode: In any Joomla article, type a trigger like
{swaggerui}or similar (check theswaggerui.phpfile for the exact string).
3. Interaction
Once you view the article on the frontend:
-
You will see a list of all available API endpoints (GET, POST, PATCH, DELETE).
-
Click an endpoint to see required parameters and data structures.
-
Click "Try it out", fill in the fields, and hit Execute to see how the Joomla API responds.