Base URL: /blog/
Authentication: Required for some endpoints (JWT / Session)
POST /blog/articles/generate_articles/Response (201 Created):
{
"message": "Articles generated successfully."
}
Response (200 OK - When limit reached):
{
"message": "3 articles have already been generated today."
}
500 Internal Server Error → AI service errorGET /blog/posts/most_viewed/Response (200 OK):
[
{
"id": 1,
"title": "Educational Article about Ancient History",
"content": "Article content here...",
"references": "Reference list...",
"topic": "Ancient History",
"views": 150,
"created_at": "2023-01-01T12:00:00Z"
}
]
GET /blog/posts/newest/Response (200 OK):
[
{
"id": 5,
"title": "Educational Article about Modern History",
"content": "Latest article content...",
"references": "Reference list...",
"topic": "Modern History",
"views": 25,
"created_at": "2023-01-05T10:30:00Z"
}
]
GET /blog/posts/all/Request:
| Name | Type | Required | Description |
|---|---|---|---|
page |
int | ✗ | Page number (default: 1) |
Response (200 OK):
{
"count": 25,
"next": "http://api.example.com/articles/all/?page=2",
"previous": null,
"results": [
{
"id": 1,
"title": "Educational Article about Ancient History",
"content": "Article content...",
"references": "References...",
"topic": "Ancient History",
"views": 150,
"created_at": "2023-01-01T12:00:00Z"
}
]
}
POST /blog/posts/{id}/add_views/Response (200 OK):
{
"views": 160
}
404 Not Found → Article not foundGET /blog/posts/{id}/recommendations/Response (200 OK):
[
{
"id": 2,
"title": "Another Article about Ancient History",
"content": "Related content...",
"references": "References...",
"topic": "Ancient History",
"views": 75,
"created_at": "2023-01-02T14:20:00Z"
}
]
404 Not Found → Article not found