Articles API
Manage and retrieve news articles from The Daily Pulse content management system.
Note: All API requests must be authenticated using Bearer tokens. Visit the Authentication guide for setup instructions.
Endpoint Overview
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /v1/articles |
Retrieve a paginated list of articles | Required |
| GET | /v1/articles/:id |
Get a single article by ID | Required |
| POST | /v1/articles |
Create a new article | Required |
| PUT | /v1/articles/:id |
Update an existing article | Required |
| DELETE | /v1/articles/:id |
Delete an article (soft delete) | Required |
Retrieve Articles List
Fetch a list of articles with optional filtering, sorting, and pagination.
GET
https://api.thedailypulse.com/v1/articles
Query Parameters
| Parameter | Type | Status | Description |
|---|---|---|---|
category |
string | Optional | Filter by category slug (e.g., world, tech, business) |
author_id |
integer | Optional | Filter articles by author ID |
status |
string | Optional | Filter by status: published, draft, archived. Default: published |
limit |
integer | Optional | Number of items per page (1-100). Default: 20 |
offset |
integer | Optional | Pagination offset. Default: 0 |
sort_by |
string | Optional | Sort field: created_at, updated_at, title. Default: created_at |
order |
string | Optional | Sort order: asc or desc. Default: desc |
search |
string | Optional | Full-text search across title and content |
Request Example
cURL
JavaScript
Python
# Get latest 10 tech articles
curl -X GET "https://api.thedailypulse.com/v1/articles?category=tech&limit=10&sort_by=created_at&order=desc" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Response Example
Response
200 OK
{
"status: "success",
"data: {
"articles: [
{
"id: 10245,
"title: "AI Revolution: New Language Model Passes All Professional Exams",
"slug: "ai-revolution-new-language-model",
"excerpt: "A breakthrough AI model has demonstrated unprecedented capabilities...",
"content: "// Full HTML content...",
"category: {
"id: 4,
"name: "Technology",
"slug: "tech"
},
"author: {
"id: 82,
"name: "James Rodriguez",
"avatar: "https://cdn.thedailypulse.com/avatars/james-rodriguez.jpg"
},
"featured_image: "https://cdn.thedailypulse.com/images/2024/12/ai-model.jpg",
"published_at: "2024-12-15T14:30:00Z",
"created_at: "2024-12-15T10:15:00Z",
"updated_at: "2024-12-15T14:28:00Z",
"views: 15420,
"is_featured: true
}
],
"pagination: {
"total: 1247,
"count: 10,
"per_page: 10,
"current_page: 1,
"total_pages: 125,
"next_offset: 10
}
}
}
Error Handling
The API uses standard HTTP status codes and returns detailed error messages in JSON format.
| Status Code | Error Code | Description |
|---|---|---|
400 |
INVALID_REQUEST |
The request body contains invalid parameters or missing required fields. |
401 |
UNAUTHORIZED |
Missing or invalid authentication token. |
403 |
FORBIDDEN |
The authenticated user does not have permission to perform this action. |
404 |
NOT_FOUND |
The requested resource does not exist. |
429 |
RATE_LIMIT_EXCEEDED |
Too many requests. Please retry after the time specified in Retry-After header. |
500 |
INTERNAL_ERROR |
An unexpected error occurred on the server. Contact support if this persists. |
Rate Limiting: Free tier accounts are limited to 100 requests/minute. Pro accounts have a limit of 1,000 requests/minute. Enterprise plans offer custom limits.
Deprecated: The /v0/articles endpoint will be shut down on March 1, 2025. Please migrate to /v1/articles immediately.