Posts API
Blog-like posts with optional tags, categories, and nested comments functionality.
List Posts
Get a paginated list of posts with filtering by user, tag, and category.
GET https://responserift.dev/api/posts?userId=5&tag=1&category=API%20Design&limit=10&offset=0
Query Parameters
userId
- Filter by user IDtag
- Filter by tag (exact match)category
- Filter by category (case-insensitive)limit
- Number of results (default: 100)offset
- Number of results to skip (default: 0)
Response
{
"total": 100,
"limit": 10,
"offset": 0,
"results": [
{
"id": 1,
"title": "Getting Started with API Design",
"body": "API design is crucial for building scalable applications...",
"userId": 1,
"slug": "getting-started-with-api-design",
"tags": ["1", "api", "design"],
"category": "API Design",
"createdAt": "2024-01-15T10:30:00.000Z"
}
]
}
Get Post
Retrieve a specific post by ID.
GET https://responserift.dev/api/posts/1
Create Post
Create a new blog post. Title, body, and userId are required.
POST https://responserift.dev/api/posts
Content-Type: application/json
{
"userId": 1,
"title": "Hello World",
"body": "This is my first blog post about API development...",
"tags": ["1", "json", "tutorial"],
"category": "General"
}
Required fields: userId, title, body
Optional fields: tags (array), category (defaults to "General")
Auto-generated: slug (from title), createdAt (current timestamp)
Update Post
Update an existing post. Only provided fields will be updated.
PUT https://responserift.dev/api/posts/1
Content-Type: application/json
{ "title": "Updated Title", "category": "Advanced" }
Delete Post
Remove a post from the system.
DELETE https://responserift.dev/api/posts/1
Comments for a Post
Nested endpoint to manage comments for a specific post.
List Comments
GET https://responserift.dev/api/posts/1/comments
Create Comment
POST https://responserift.dev/api/posts/1/comments
Content-Type: application/json
{ "userId": 2, "body": "Great post! This really helped me understand API design." }
Note: Comments are automatically associated with the post ID from the URL path.
Warning: All mutations are in-memory only and reset on server restart.