https://api-testing.svlautomations.in/ Content-Type: application/json for all POST and PUT
requests.
Retrieve all categories. (Append ?id=1 to get a specific category).
[
{
"id": 1,
"name": "Technology"
}
]
Create a new category.
{
"name": "Technology"
}
{
"message": "Category created",
"id": 1
}
Update an existing category. Requires id in URL.
{
"id": 1,
"name": "Advanced Technology"
}
{
"message": "Category updated"
}
Delete a category. Requires id in URL.
{
"message": "Category deleted"
}
Retrieve all blogs. (Append ?id=1 to get a specific blog).
{
"id": 1,
"title": "Technology Learning Postman",
"content": "Postman is great for API testing...",
"category_id": 1
}
Create a blog publicly (no user attached).
{
"title": "Learning Postman",
"content": "Postman is great for API testing...",
"category_id": 1
}
{
"message": "Public blog created",
"id": 1
}
Update a public blog. Requires id in URL.
{
"id":1,
"title": "Learning Postman Updated",
"content": "Postman is excellent for API testing...",
"category_id": 1
}
{
"message": "Public blog updated"
}
Delete a public blog. Requires id in URL.
{
"message": "Public blog deleted"
}
Read all blogs belonging to a specific category.
[
{
"id": 1,
"title": "Learning Postman",
"content": "...",
"category_id": 1,
"user_id": null
}
]
Read all blogs created between a specific date range.
[
{
"id": 1,
"title": "Learning Postman",
"created_at": "2023-10-15 14:30:00"
}
]
Register a new user account.
{
"username": "student1",
"password": "password123"
}
{
"message": "User registered successfully"
}
Login to receive your Bearer token.
{
"username": "student1",
"password": "password123"
}
{
"message": "Login successful",
"token": "a1b2c3d4e5f6g7h8i9j0"
}
Create a blog tied to the currently logged-in user.
{
"title": "My First Secure Blog",
"content": "This is protected by a token.",
"category_id": 1
}
{
"message": "Auth blog created",
"id": 2
}
Update a blog (User can only update their own blogs). Requires id in URL.
{
"title": "Updated Secure Blog",
"content": "Updated content here.",
"category_id": 1
}
{
"message": "Auth blog updated"
}
Delete a blog (User can only delete their own blogs). Requires id in URL.
{
"message": "Auth blog deleted"
}
Read all blogs written by the logged-in user.
[
{
"id": 2,
"title": "Updated Secure Blog",
"content": "Updated content here.",
"category_id": 1,
"user_id": 5,
"created_at": "2023-10-15 15:00:00"
}
]