58 lines
1.5 KiB
Markdown
58 lines
1.5 KiB
Markdown
|
|
# REST API
|
||
|
|
|
||
|
|
MokoJoomCross includes a WebServices plugin that provides REST API endpoints via Joomla's API application.
|
||
|
|
|
||
|
|
## Authentication
|
||
|
|
|
||
|
|
All endpoints require a Joomla API token. Generate one in **Users → Manage → [User] → API Tokens**.
|
||
|
|
|
||
|
|
Include the token in the `Authorization` header:
|
||
|
|
|
||
|
|
```
|
||
|
|
Authorization: Bearer YOUR_API_TOKEN
|
||
|
|
```
|
||
|
|
|
||
|
|
## Base URL
|
||
|
|
|
||
|
|
```
|
||
|
|
https://yoursite.com/api/index.php/v1/mokojoomcross/
|
||
|
|
```
|
||
|
|
|
||
|
|
## Endpoints
|
||
|
|
|
||
|
|
### Posts
|
||
|
|
|
||
|
|
| Method | Endpoint | Description |
|
||
|
|
|--------|----------|-------------|
|
||
|
|
| GET | `/v1/mokojoomcross/posts` | List all cross-posts |
|
||
|
|
| GET | `/v1/mokojoomcross/posts/:id` | Get single post details |
|
||
|
|
| POST | `/v1/mokojoomcross/posts` | Create a cross-post entry |
|
||
|
|
| DELETE | `/v1/mokojoomcross/posts/:id` | Delete a post |
|
||
|
|
|
||
|
|
### Services
|
||
|
|
|
||
|
|
| Method | Endpoint | Description |
|
||
|
|
|--------|----------|-------------|
|
||
|
|
| GET | `/v1/mokojoomcross/services` | List connected services |
|
||
|
|
| GET | `/v1/mokojoomcross/services/:id` | Get service details |
|
||
|
|
|
||
|
|
## Example
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# List all posts
|
||
|
|
curl -H "Authorization: Bearer YOUR_TOKEN" \
|
||
|
|
https://yoursite.com/api/index.php/v1/mokojoomcross/posts
|
||
|
|
|
||
|
|
# List services
|
||
|
|
curl -H "Authorization: Bearer YOUR_TOKEN" \
|
||
|
|
https://yoursite.com/api/index.php/v1/mokojoomcross/services
|
||
|
|
```
|
||
|
|
|
||
|
|
## Filtering
|
||
|
|
|
||
|
|
Posts support query parameters:
|
||
|
|
- `filter[status]=posted` — Filter by status (queued, posting, posted, failed, scheduled)
|
||
|
|
- `filter[service_id]=5` — Filter by service
|
||
|
|
- `page[limit]=20` — Pagination limit
|
||
|
|
- `page[offset]=0` — Pagination offset
|