Resources
Comments
Writes are simulated
POST, PUT, PATCH, and DELETE validate your input and return realistic responses, but the shared dataset is never modified.
Endpoints
- GET
/commentsList comments - GET
/comments/{id}Get a comment - POST
/commentsCreate a comment (simulated) - PUT
/comments/{id}Replace a comment (simulated) - PATCH
/comments/{id}Update a comment (simulated) - DELETE
/comments/{id}Delete a comment (simulated)
The comment object
Use select to return a subset of these fields. Sort with sortBy on id, likes, postId, userId; search matches . See query parameters.
| Field | Type | Notes |
|---|---|---|
id | integer | min -9007199254740991, max 9007199254740991 |
body | string | |
postId | integer | min -9007199254740991, max 9007199254740991 |
userId | integer | min -9007199254740991, max 9007199254740991 |
likes | integer | min -9007199254740991, max 9007199254740991 |
List comments
/api/v1/commentsReturns a paginated list of comments. Supports pagination, field selection, sorting, and filtering.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
limit | query | integer | Number of records to return (1-100).Default: 30Range: 1-100 |
skip | query | integer | Number of records to skip before returning results.Default: 0Range: 0-1000000 |
select | query | string | Comma-separated list of fields to return. id is always included. Allowed: id, body, postId, userId, likes. |
sortBy | query | string | Field to sort by.One of: id, likes, postId, userIdDefault: id |
order | query | string | Sort direction.One of: asc, descDefault: asc |
postId | query | integer | Only return comments on this post ID. |
userId | query | integer | Only return comments that belong to this user ID. |
delay | query | integer | Delay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000 |
Status codes
- 200A page of comments with
total,skip, andlimitmetadata. - 400Invalid path or query parameter (
INVALID_PARAMETER/INVALID_ID). - 429Too many requests from this IP (
RATE_LIMIT_EXCEEDED). - 503The database is temporarily unavailable (
SERVICE_UNAVAILABLE).
Request
curl 'https://test.naimulhassan.me/api/v1/comments?limit=2'Example responses
Captured from the real API with the requests shown on this page.
{
"comments": [
{
"id": 1,
"body": "Do you have any recommendations for someone just starting out?",
"postId": 1,
"userId": 87,
"likes": 9
},
{
"id": 2,
"body": "Sent this to a friend who will love it.",
"postId": 2,
"userId": 9,
"likes": 29
}
],
"total": 300,
"skip": 0,
"limit": 2
}Try it
Get a comment
/api/v1/comments/{id}Returns a single comment by its numeric ID.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer | Numeric comment ID (positive integer).Min: 1 |
select | query | string | Comma-separated list of fields to return. id is always included. Allowed: id, body, postId, userId, likes. |
delay | query | integer | Delay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000 |
Status codes
- 200The comment object.
- 400Invalid path or query parameter (
INVALID_PARAMETER/INVALID_ID). - 404No record exists with that ID (
RESOURCE_NOT_FOUND).
Request
curl 'https://test.naimulhassan.me/api/v1/comments/1'Example responses
Captured from the real API with the requests shown on this page.
{
"id": 1,
"body": "Do you have any recommendations for someone just starting out?",
"postId": 1,
"userId": 87,
"likes": 9
}Try it
Create a comment (simulated)
/api/v1/commentsValidates the body and returns the comment as it would be created, with the next available ID. Nothing is persisted: the shared dataset is never modified.
Headers
| Name | In | Type | Description |
|---|---|---|---|
Content-Typerequired | header | string | Must be application/json. |
Request body
Comments fields.
| Field | Type | Required | Notes |
|---|---|---|---|
body | string | Yes | min length 1, max length 2000 |
postId | integer | Yes | min 0, max 1000000000 |
userId | integer | Yes | min 0, max 1000000000 |
Status codes
- 201The simulated comment, including its new
id. - 400The request body is not valid JSON (
INVALID_JSON). - 422The JSON body failed validation (
VALIDATION_ERROR).
Request
curl -X POST 'https://test.naimulhassan.me/api/v1/comments' \
-H 'Content-Type: application/json' \
-d '{
"body": "Great write-up, thanks for sharing!",
"postId": 1,
"userId": 3
}'Example responses
Captured from the real API with the requests shown on this page.
{
"id": 301,
"body": "Great write-up, thanks for sharing!",
"postId": 1,
"userId": 3,
"likes": 0
}Try it
Replace a comment (simulated)
/api/v1/comments/{id}Validates a complete replacement body and returns the resulting comment. The stored record is not changed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer | Numeric comment ID (positive integer).Min: 1 |
Headers
| Name | In | Type | Description |
|---|---|---|---|
Content-Typerequired | header | string | Must be application/json. |
Request body
Complete comment representation.
| Field | Type | Required | Notes |
|---|---|---|---|
body | string | Yes | min length 1, max length 2000 |
postId | integer | Yes | min 0, max 1000000000 |
userId | integer | Yes | min 0, max 1000000000 |
Status codes
- 200The replaced comment.
- 400Invalid path or query parameter (
INVALID_PARAMETER/INVALID_ID). - 404No record exists with that ID (
RESOURCE_NOT_FOUND). - 422The JSON body failed validation (
VALIDATION_ERROR).
Request
curl -X PUT 'https://test.naimulhassan.me/api/v1/comments/1' \
-H 'Content-Type: application/json' \
-d '{
"body": "Edited comment text.",
"postId": 1,
"userId": 3
}'Example responses
Captured from the real API with the requests shown on this page.
{
"id": 1,
"body": "Edited comment text.",
"postId": 1,
"userId": 3,
"likes": 0
}Try it
Update a comment (simulated)
/api/v1/comments/{id}Merges the provided fields into the existing comment and returns the result. The stored record is not changed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer | Numeric comment ID (positive integer).Min: 1 |
Headers
| Name | In | Type | Description |
|---|---|---|---|
Content-Typerequired | header | string | Must be application/json. |
Request body
Any subset of comment fields.
| Field | Type | Required | Notes |
|---|---|---|---|
body | string | No | min length 1, max length 2000 |
postId | integer | No | min 0, max 1000000000 |
userId | integer | No | min 0, max 1000000000 |
Status codes
- 200The updated comment.
- 400Invalid path or query parameter (
INVALID_PARAMETER/INVALID_ID). - 404No record exists with that ID (
RESOURCE_NOT_FOUND). - 422The JSON body failed validation (
VALIDATION_ERROR).
Request
curl -X PATCH 'https://test.naimulhassan.me/api/v1/comments/1' \
-H 'Content-Type: application/json' \
-d '{
"body": "Edited comment text."
}'Example responses
Captured from the real API with the requests shown on this page.
{
"id": 1,
"body": "Edited comment text.",
"postId": 1,
"userId": 87,
"likes": 9
}Try it
Delete a comment (simulated)
/api/v1/comments/{id}Returns 204 No Content if the comment exists. The record is not actually removed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | integer | Numeric comment ID (positive integer).Min: 1 |
Status codes
- 204Empty body.
- 400Invalid path or query parameter (
INVALID_PARAMETER/INVALID_ID). - 404No record exists with that ID (
RESOURCE_NOT_FOUND).
Request
curl -X DELETE 'https://test.naimulhassan.me/api/v1/comments/1'Example responses
Captured from the real API with the requests shown on this page.
No response body.