Frequently Asked Question
Quote - Retrieve a random quotation with optional categorisation
Last Updated 5 hours ago
Quote API
Overview
The Quote API returns a single random quote from the QUOTES system. Optionally, you can filter by category.
Version
1.000
Endpoint
/v2/quote
Authentication
This API requires authentication using an API key. The key should be passed in the X_API_Key header.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| category | string | Optional category filter (max 20 characters). |
Response
The API returns a JSON object with the following structure:
| Field | Type | Description |
|---|---|---|
| status | string | success when a quote is returned; otherwise fail or an authentication/validation status string. |
| quote | string | The quote text (present when status is success). |
| author | string | The quote author. If the author is empty in the database, the API returns "Unknown". |
| categories | array | (JSON). If categories cannot be decoded, an empty array is returned. |
| error | string | Error details when status is fail (not present on success). |
Example Request
GET /v2/quote?category=motivation
X_API_Key: your-api-key Example Response (Success)
{
"status": "success",
"quote": "Do or do not. There is no try.",
"author": "Yoda",
"categories": ["motivation", "discipline"]
} Example Response (No Results)
{
"status": "fail",
"error": "No quotes found for category motivation"
} Error Handling
- If authentication/validation fails:
{"status":"[validation status]"} - If no matching quotes are found:
{"status":"fail","error":"No quotes found for category ..."} - If the response status is not set for any reason, the API forces:
{"status":"fail"}
Notes
- All responses are sent with the
Content-Type: application/jsonheader.
Security
- Ensure that the API key is kept secure and not exposed in client-side code.
