🌐 Gold Standard REST API Reference¶
Complete API documentation for integrating with the Gold Standard module.
Base URL: https://yoursite.com/api/v1/goldstandard
Authentication¶
All API requests require authentication via Bearer token or API key.
# Bearer Token
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
# API Key
X-API-Key: gs_live_abc123def456
Obtaining Tokens¶
POST /api/v1/auth/login
Content-Type: application/json
{
"username": "user@example.com",
"password": "your_password"
}
Response:
API Overview¶
flowchart LR
subgraph Endpoints["API Endpoints"]
ART[/articles]
CAT[/categories]
TAG[/tags]
CMT[/comments]
USR[/authors]
end
subgraph Methods["HTTP Methods"]
GET[GET]
POST[POST]
PUT[PUT]
DEL[DELETE]
end
Methods --> Endpoints Articles¶
List Articles¶
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
per_page | integer | 15 | Items per page (max 100) |
status | string | published | Filter by status |
category | integer | - | Filter by category ID |
author | integer | - | Filter by author ID |
tag | string | - | Filter by tag slug |
search | string | - | Search in title and content |
sort | string | published_at | Sort field |
order | string | desc | Sort order (asc/desc) |
include | string | - | Include relations (author,category,tags) |
Response:
Note: Article IDs use XMF ULID format (26 characters, lexicographically sortable).
{
"data": [
{
"id": "01HV8X5Z0KDMVR8SDPY62J9ACP",
"type": "article",
"attributes": {
"title": "Getting Started with XOOPS 2026",
"slug": "getting-started-xoops-2026",
"excerpt": "Learn how to build modern XOOPS modules...",
"status": "published",
"views": 1250,
"reading_time": 8,
"created_at": "2026-01-15T10:30:00Z",
"updated_at": "2026-01-20T14:45:00Z",
"published_at": "2026-01-15T12:00:00Z"
},
"relationships": {
"author": {
"data": {"type": "author", "id": "01HV8X4A0KAUTHOR00000000001"}
},
"category": {
"data": {"type": "category", "id": "01HV8X4B0KCATEG000000000005"}
},
"tags": {
"data": [
{"type": "tag", "id": "01HV8X4C0KTAG0000000000001"},
{"type": "tag", "id": "01HV8X4C0KTAG0000000000003"}
]
}
},
"links": {
"self": "/api/v1/goldstandard/articles/01HV8X5Z0KDMVR8SDPY62J9ACP",
"web": "/articles/getting-started-xoops-2026"
}
}
],
"included": [
{
"id": "01HV8X4A0KAUTHOR00000000001",
"type": "author",
"attributes": {
"name": "John Doe",
"avatar": "https://example.com/avatars/john.jpg"
}
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 47,
"last_page": 4,
"total_published": 42,
"total_draft": 5
},
"links": {
"first": "/api/v1/goldstandard/articles?page=1",
"last": "/api/v1/goldstandard/articles?page=4",
"prev": null,
"next": "/api/v1/goldstandard/articles?page=2"
}
}
Get Single Article¶
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | string (ULID) | Article ID (26-character XMF ULID) |
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
include | string | Include relations (author,category,tags,comments) |
Response:
{
"data": {
"id": "01HV8X5Z0KDMVR8SDPY62J9ACP",
"type": "article",
"attributes": {
"title": "Getting Started with XOOPS 2026",
"slug": "getting-started-xoops-2026",
"content": "<p>Full article content in HTML...</p>",
"excerpt": "Learn how to build modern XOOPS modules...",
"status": "published",
"views": 1250,
"word_count": 1560,
"reading_time": 8,
"created_at": "2026-01-15T10:30:00Z",
"updated_at": "2026-01-20T14:45:00Z",
"published_at": "2026-01-15T12:00:00Z"
},
"relationships": {
"author": {
"data": {"type": "author", "id": "01HV8X4A0KAUTHOR00000000001"}
},
"category": {
"data": {"type": "category", "id": "01HV8X4B0KCATEG000000000005"}
},
"tags": {
"data": [
{"type": "tag", "id": "01HV8X4C0KTAG0000000000001"},
{"type": "tag", "id": "01HV8X4C0KTAG0000000000003"}
]
}
}
}
}
Create Article¶
Request Body:
{
"title": "My New Article",
"content": "<p>Article content here...</p>",
"category_id": "01HV8X4B0KCATEG000000000005",
"tags": ["xoops", "tutorial", "php"],
"status": "draft",
"publish_at": null
}
Validation Rules:
| Field | Rules |
|---|---|
title | Required, string, 3-255 characters |
content | Required, string, min 50 characters |
category_id | Required, ULID string, must exist |
tags | Optional, array, max 10 items |
tags.* | String, max 50 characters |
status | Optional, enum: draft, published |
publish_at | Optional, ISO 8601 datetime, future date |
Response (201 Created):
{
"data": {
"id": "01HV8X5Z0KDMVR8SDPY62J9ACQ",
"type": "article",
"attributes": {
"title": "My New Article",
"slug": "my-new-article",
"status": "draft",
"created_at": "2026-01-29T10:00:00Z"
}
},
"links": {
"self": "/api/v1/goldstandard/articles/01HV8X5Z0KDMVR8SDPY62J9ACQ"
}
}
Update Article¶
Request Body:
{
"title": "Updated Title",
"content": "<p>Updated content...</p>",
"category_id": "01HV8X4B0KCATEG000000000006"
}
Response (200 OK):
{
"data": {
"id": "01HV8X5Z0KDMVR8SDPY62J9ACP",
"type": "article",
"attributes": {
"title": "Updated Title",
"updated_at": "2026-01-29T15:30:00Z"
}
}
}
Delete Article¶
Response (204 No Content)
Publish Article¶
Response (200 OK):
{
"data": {
"id": "01HV8X5Z0KDMVR8SDPY62J9ACP",
"type": "article",
"attributes": {
"status": "published",
"published_at": "2026-01-29T16:00:00Z"
}
},
"message": "Article published successfully"
}
Archive Article¶
Response (200 OK):
{
"data": {
"id": "01HV8X5Z0KDMVR8SDPY62J9ACP",
"type": "article",
"attributes": {
"status": "archived"
}
},
"message": "Article archived successfully"
}
Categories¶
List Categories¶
Response:
{
"data": [
{
"id": "01HV8X4B0KCATEG000000000001",
"type": "category",
"attributes": {
"name": "Tutorials",
"slug": "tutorials",
"description": "Step-by-step tutorials",
"article_count": 15,
"parent_id": null
},
"children": [
{
"id": "01HV8X4B0KCATEG000000000004",
"type": "category",
"attributes": {
"name": "Beginner",
"slug": "beginner",
"article_count": 8,
"parent_id": "01HV8X4B0KCATEG000000000001"
}
}
]
}
]
}
Get Category¶
Category Articles¶
Tags¶
List Tags¶
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
limit | integer | Max tags to return (default 50) |
min_count | integer | Minimum article count |
Response:
{
"data": [
{
"id": "01HV8X4C0KTAG0000000000001",
"type": "tag",
"attributes": {
"name": "XOOPS",
"slug": "xoops",
"article_count": 25
}
},
{
"id": "01HV8X4C0KTAG0000000000002",
"type": "tag",
"attributes": {
"name": "PHP 8",
"slug": "php-8",
"article_count": 18
}
}
]
}
Tag Articles¶
Comments¶
List Article Comments¶
Response:
{
"data": [
{
"id": "01HV8X4D0KCOMMENT0000000001",
"type": "comment",
"attributes": {
"content": "Great article, thanks!",
"status": "approved",
"created_at": "2026-01-20T09:15:00Z"
},
"relationships": {
"author": {
"data": {"type": "user", "id": "01HV8X4A0KAUTHOR00000000042"}
}
}
}
],
"meta": {
"total": 12
}
}
Create Comment¶
Request Body:
Error Responses¶
Validation Error (422)¶
{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid.",
"details": [
{
"field": "title",
"message": "The title field is required."
},
{
"field": "content",
"message": "The content must be at least 50 characters."
}
]
}
}
Not Found (404)¶
Unauthorized (401)¶
Forbidden (403)¶
{
"error": {
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}
}
Rate Limited (429)¶
{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests. Please try again later.",
"retry_after": 60
}
}
Rate Limits¶
| Endpoint Type | Limit | Window |
|---|---|---|
| Read (GET) | 100 | 1 minute |
| Write (POST/PUT) | 20 | 1 minute |
| Delete | 10 | 1 minute |
Rate Limit Headers:
Webhooks¶
Configure webhooks to receive real-time notifications.
Available Events¶
| Event | Description |
|---|---|
article.created | New article created |
article.published | Article published |
article.updated | Article updated |
article.deleted | Article deleted |
comment.created | New comment added |
Webhook Payload¶
{
"event": "article.published",
"timestamp": "2026-01-29T16:00:00Z",
"data": {
"id": "01HV8X5Z0KDMVR8SDPY62J9ACP",
"type": "article",
"attributes": {
"title": "Article Title",
"slug": "article-title"
}
}
}
SDK Examples¶
PHP¶
<?php
use GoldStandard\ApiClient;
$client = new ApiClient('your-api-key');
// List articles
$articles = $client->articles()->list([
'status' => 'published',
'per_page' => 10,
]);
// Create article
$article = $client->articles()->create([
'title' => 'New Article',
'content' => 'Content here...',
'category_id' => 5,
]);
// Publish article
$client->articles()->publish($article->id);
JavaScript¶
import { GoldStandardClient } from '@xoops/goldstandard-sdk';
const client = new GoldStandardClient({
apiKey: 'your-api-key',
baseUrl: 'https://yoursite.com/api/v1/goldstandard'
});
// List articles
const { data, meta } = await client.articles.list({
status: 'published',
include: ['author', 'tags']
});
// Create article
const article = await client.articles.create({
title: 'New Article',
content: 'Content here...',
categoryId: 5
});