Returns a list of all posts in the system. Requires valid authentication token.
All authentication strategies are supported:
JWT Token: Standard JWT with HS256 algorithm
Database Token: Custom token stored in user record
API Key: 40-character alphanumeric key
Devise Token Auth: Requires uid and client headers
| Code | Description |
|---|---|
| 401 | Unauthorized - Invalid or missing token |
| 403 | Forbidden - Token valid but insufficient permissions |
curl -X GET https://your-domain.com/api/v2/posts \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json"
Response (200):
[
{
"id": 1,
"title": "Sample Post Title",
"content": "This is the content of the post...",
"author_id": 123,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"id": 2,
"title": "Another Post",
"content": "Another post content...",
"author_id": 456,
"created_at": "2024-01-16T14:20:00Z",
"updated_at": "2024-01-16T14:20:00Z"
}
]
Error Response (401):
{
"error": "Unauthorized"
}
| Header name | Description |
|---|---|
|
Authorization required |
Bearer token for authentication |
|
uid optional |
User email (required for devise_token_auth) |
|
client optional |
Client ID (required for devise_token_auth) |