2026-05-28 11:14:57 -05:00
# API Endpoints
2026-06-07 09:25:45 -05:00
MokoSuite provides 6 remote management endpoints accessible via query string parameter. All endpoints require HTTPS and Bearer token authentication.
2026-05-28 11:14:57 -05:00
## Authentication
All endpoints require the `health_api_token` as a Bearer token in the Authorization header:
```
Authorization: Bearer <health_api_token>
```
The token is auto-generated during plugin installation and stored as a read-only parameter in the plugin configuration. It can also be passed as a `token` query parameter as a fallback.
Token validation uses `hash_equals()` for timing-safe comparison. If no token is configured, the endpoint returns HTTP 503. An invalid token returns HTTP 401.
## Endpoints
### 1. Health Check
```
2026-06-07 09:25:45 -05:00
GET /?mokosuite=health
2026-05-28 11:14:57 -05:00
```
Runs 16 diagnostic checks and returns a comprehensive health report. See [Health Monitoring ](Health-Monitoring ) for full documentation of all checks and response format.
**Response** : JSON object with `status` (`ok` /`degraded` /`error` ), `reason` , `timestamp` , `checks` , and `meta` .
**HTTP Status** : 200 (ok/degraded), 503 (error).
---
### 2. Site Info
```
2026-06-07 09:25:45 -05:00
GET /?mokosuite=info
2026-05-28 11:14:57 -05:00
```
Returns a compact summary of the Joomla site.
**Response** :
| Field | Description |
|---|---|
| `site_name` | Joomla site name |
| `site_url` | Site root URL |
| `joomla_version` | Joomla CMS version |
| `php_version` | PHP version |
| `db_type` | Database driver (e.g. `pdomysql` ) |
| `debug` | Whether debug mode is on |
| `sef` | Whether SEF URLs are enabled |
| `caching` | Whether caching is enabled |
| `articles` | Total article count |
| `users` | Total user count |
| `extensions` | Number of enabled extensions |
| `brand` | Configured brand name |
2026-06-07 09:25:45 -05:00
| `plugin_version` | MokoSuite plugin version |
2026-05-28 11:14:57 -05:00
---
### 3. Remote Install
```
2026-06-07 09:25:45 -05:00
POST /?mokosuite=install
2026-05-28 11:14:57 -05:00
Content-Type: application/json
{"url": "https://example.com/extension.zip"}
```
Downloads and installs a Joomla extension from the provided URL. The extension is downloaded to a temporary directory, extracted, and installed using Joomla's installer API.
**Response** : JSON object with `status` , `extension` name, and `message` .
**HTTP Status** : 200 (success), 400 (missing URL), 405 (not POST), 500 (install failed).
---
### 4. Update Check
```
2026-06-07 09:25:45 -05:00
POST /?mokosuite=update
2026-05-28 11:14:57 -05:00
```
Clears the Joomla update cache and triggers a fresh update check via `Updater::findUpdates()` .
**Response** :
| Field | Description |
|---|---|
| `status` | `ok` |
| `updates_found` | Number of available updates |
| `message` | Human-readable summary |
**HTTP Status** : 200 (success), 405 (not POST), 500 (failed).
---
### 5. Cache Clear
```
2026-06-07 09:25:45 -05:00
POST /?mokosuite=cache
2026-05-28 11:14:57 -05:00
```
Clears the Joomla site cache, admin cache, and PHP OPcache (if available).
**Response** :
| Field | Description |
|---|---|
| `status` | `ok` |
| `message` | `Cache cleared` |
**HTTP Status** : 200 (success), 405 (not POST), 500 (failed).
---
### 6. Backup (Akeeba)
```
2026-06-07 09:25:45 -05:00
POST /?mokosuite=backup
2026-05-28 11:14:57 -05:00
Content-Type: application/json
{"profile": 1}
```
Triggers an Akeeba Backup using the specified profile (defaults to profile 1). Requires Akeeba Backup to be installed.
**Response** :
| Field | Description |
|---|---|
| `status` | `started` |
| `profile` | Backup profile ID used |
| `message` | `Backup started` |
**HTTP Status** : 200 (started), 404 (Akeeba not installed), 405 (not POST), 500 (failed), 501 (Akeeba Engine not loadable).
## Error Responses
All endpoints return errors in a consistent format:
```json
{
"error" : "Error description" ,
"message" : "Additional detail (optional)"
}
```
### Common Error Codes
| HTTP Status | Meaning |
|---|---|
| 400 | Bad request (unknown action, missing parameters) |
| 401 | Invalid or missing authentication token |
| 405 | Wrong HTTP method (e.g. GET when POST is required) |
| 500 | Server error during operation |
| 503 | No API token configured |
## Unknown Actions
Requesting an unknown action returns HTTP 400 with the list of available actions:
```json
{
"error" : "Unknown action" ,
"action" : "invalid" ,
2026-05-30 12:50:11 -05:00
"available" : [ "health" , "install" , "update" , "cache" , "backup" , "info" , "reset" , "snapshot" ]
2026-05-28 11:14:57 -05:00
}
```
## Joomla REST API Routes
2026-06-07 09:25:45 -05:00
In addition to the query-string endpoints above, MokoSuite registers standard Joomla API routes via the `plg_webservices_mokosuite` plugin:
2026-05-28 11:14:57 -05:00
2026-05-30 11:41:20 -05:00
| Route | Controller | Description |
|---|---|---|
2026-06-07 09:25:45 -05:00
| `GET /api/v1/mokosuite/health` | HealthController | Full site health diagnostics |
| `POST /api/v1/mokosuite/cache` | CacheController | Clear all caches |
| `POST /api/v1/mokosuite/update` | UpdateController | Trigger update check |
| `POST /api/v1/mokosuite/install` | InstallController | Install extension from ZIP URL |
| `POST /api/v1/mokosuite/reset` | ResetController | Restore site to baseline snapshot |
| `GET/POST /api/v1/mokosuite/snapshot` | SnapshotController | List or create snapshots |
| `POST /api/v1/mokosuite/sync` | SyncController | Push content to all sync targets |
| `POST /api/v1/mokosuite/sync-receive` | SyncReceiveController | Receive content from source site |
| `GET /api/v1/mokosuite/extensions` | ExtensionsController | List installed extensions |
2026-05-28 11:14:57 -05:00
These routes use Joomla's standard API authentication (API token in `X-Joomla-Token` header) and are useful for integrations that already use the Joomla API framework.
2026-05-30 11:41:20 -05:00
### Install Endpoint (REST API)
```
2026-06-07 09:25:45 -05:00
POST /api/index.php/v1/mokosuite/install
2026-05-30 11:41:20 -05:00
X-Joomla-Token: <api-token>
Content-Type: application/json
2026-06-07 09:25:45 -05:00
{"url": "https://git.mokoconsulting.tech/.../plg_system_mokosuite-02.20.00.zip"}
2026-05-30 11:41:20 -05:00
```
Downloads the ZIP from the given URL and installs it via Joomla's Installer. Requires a Joomla API token with `core.manage` permission on `com_installer` .
**Constraints:**
- URL must use `http` or `https` scheme
- URL path must end in `.zip`
- Maximum download size: 64 MB
**Success Response** (HTTP 200):
```json
{
"status" : "ok" ,
"message" : "Extension installed successfully" ,
"extension" : {
2026-06-07 09:25:45 -05:00
"name" : "MokoSuite" ,
2026-05-30 11:41:20 -05:00
"version" : "02.20.00" ,
"type" : "plugin"
},
2026-06-07 09:25:45 -05:00
"source_url" : "https://git.mokoconsulting.tech/.../plg_system_mokosuite-02.20.00.zip"
2026-05-30 11:41:20 -05:00
}
```
**Error Responses:**
| HTTP Status | Condition |
|---|---|
| 400 | Missing `url` field, non-HTTPS URL, or URL not ending in `.zip` |
| 403 | API token lacks `core.manage` on `com_installer` |
| 405 | Request method is not POST |
| 500 | Download or installation failed |
2026-05-30 12:50:11 -05:00
### Reset Endpoint (REST API)
```
2026-06-07 09:25:45 -05:00
POST /api/index.php/v1/mokosuite/reset
2026-05-30 12:50:11 -05:00
X-Joomla-Token: <api-token>
Content-Type: application/json
{"baseline": "default"}
```
Restores the site to a named baseline snapshot. The `baseline` field is optional and defaults to the active baseline configured in the plugin.
Requires `core.manage` permission on `com_plugins` .
**Success Response** (HTTP 200):
```json
{
"status" : "ok" ,
"message" : "Site restored to baseline: default" ,
"baseline" : "default" ,
"restored_tables" : 15 ,
"media_restored" : true
}
```
### Snapshot Endpoint (REST API)
**List snapshots:**
```
2026-06-07 09:25:45 -05:00
GET /api/index.php/v1/mokosuite/snapshot
2026-05-30 12:50:11 -05:00
X-Joomla-Token: <api-token>
```
**Create snapshot:**
```
2026-06-07 09:25:45 -05:00
POST /api/index.php/v1/mokosuite/snapshot
2026-05-30 12:50:11 -05:00
X-Joomla-Token: <api-token>
Content-Type: application/json
{"name": "my-baseline"}
```
The `name` field is optional and defaults to the active baseline name.
**Success Response** (HTTP 200):
```json
{
"status" : "ok" ,
"message" : "Snapshot created" ,
"name" : "my-baseline" ,
"tables" : 15 ,
"has_media" : true
}
```
2026-05-30 14:06:46 -05:00
### Extensions Endpoint (REST API)
```
2026-06-07 09:25:45 -05:00
GET /api/index.php/v1/mokosuite/extensions
2026-05-30 14:06:46 -05:00
X-Joomla-Token: <api-token>
```
Lists all installed Joomla extensions with version, enabled/protected/locked status, and update server info.
**Query filters:**
| Parameter | Description | Example |
|---|---|---|
| `type` | Filter by extension type | `?type=plugin` |
| `search` | Search name or element | `?search=moko` |
| `enabled` | Filter by enabled status | `?enabled=1` |
2026-06-07 09:25:45 -05:00
**Query-string equivalent:** `GET /?mokosuite=extensions&search=moko&type=plugin`
2026-05-30 14:06:46 -05:00
Requires `core.manage` on `com_installer` .
**Success Response** (HTTP 200):
```json
{
"status" : "ok" ,
"count" : 3 ,
"extensions" : [
{
"extension_id" : 456 ,
2026-06-07 09:25:45 -05:00
"name" : "System - MokoSuite" ,
2026-05-30 14:06:46 -05:00
"type" : "plugin" ,
2026-06-07 09:25:45 -05:00
"element" : "mokosuite" ,
2026-05-30 14:06:46 -05:00
"folder" : "system" ,
"client_id" : 0 ,
"enabled" : true ,
"protected" : true ,
"locked" : false ,
"version" : "02.21.00" ,
"author" : "Moko Consulting" ,
"update_server" : {
2026-06-07 09:25:45 -05:00
"name" : "MokoSuite Update Server" ,
2026-05-30 14:06:46 -05:00
"location" : "https://git.mokoconsulting.tech/.../updates.xml" ,
"enabled" : true
}
}
]
}
```