REST API Endpoints
Caution
Demo Page - This is a demo page to showcase the multi-tab documentation feature. This content is for illustration purposes only.
REST API Endpoints
Our REST API provides endpoints for accessing and manipulating data. All endpoints return data in JSON format.
Base URL
All API requests should be made to the following base URL:
https://api.example.com/v1
Users Endpoints
Get All Users
GET /users
Returns a list of all users. Supports pagination parameters.
Query Parameters:
Parameter | Type | Description |
---|---|---|
page | integer | Page number (default: 1) |
limit | integer | Number of records per page (default: 50, max: 100) |
sort | string | Field to sort by (e.g., “name”, “created_at”) |
Response:
{ "data": [ { "id": "user_123", "name": "John Doe", "email": "john@example.com", "created_at": "2023-01-15T08:30:00Z" }, // More users... ], "meta": { "total": 250, "page": 1, "limit": 50 }}
Get User by ID
GET /users/{id}
Returns a single user by ID.
Response:
{ "data": { "id": "user_123", "name": "John Doe", "email": "john@example.com", "created_at": "2023-01-15T08:30:00Z", "profile": { "bio": "Software developer", "location": "New York", "avatar_url": "https://example.com/avatars/john.jpg" } }}
Products Endpoints
Get All Products
GET /products
Returns a list of all products. Supports filtering and pagination.
Query Parameters:
Parameter | Type | Description |
---|---|---|
category | string | Filter by category |
min_price | number | Filter by minimum price |
max_price | number | Filter by maximum price |
page | integer | Page number (default: 1) |
limit | integer | Number of records per page (default: 50, max: 100) |
Response:
{ "data": [ { "id": "prod_123", "name": "Example Product", "description": "This is an example product", "price": 49.99, "category": "electronics" }, // More products... ], "meta": { "total": 350, "page": 1, "limit": 50 }}
Error Handling
All endpoints follow standard HTTP status codes and include detailed error messages when appropriate:
Status Code | Description |
---|---|
200 | OK - Request succeeded |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Authentication required |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource doesn’t exist |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server error occurred |
Error responses include a message explaining what went wrong:
{ "error": { "code": "invalid_parameter", "message": "The parameter 'email' is not a valid email address", "request_id": "req_abc123" }}