Skip to content
Mock APIs

Resources

Comments

Comments left by users on posts. Every comment references an existing post and user. The dataset contains 300 comments.

Writes are simulated

POST, PUT, PATCH, and DELETE validate your input and return realistic responses, but the shared dataset is never modified.

Endpoints

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.

comment fields
FieldTypeNotes
idintegermin -9007199254740991, max 9007199254740991
bodystring
postIdintegermin -9007199254740991, max 9007199254740991
userIdintegermin -9007199254740991, max 9007199254740991
likesintegermin -9007199254740991, max 9007199254740991

List comments

GET/api/v1/comments

Returns a paginated list of comments. Supports pagination, field selection, sorting, and filtering.

Parameters

Parameters for List comments
NameInTypeDescription
limitqueryintegerNumber of records to return (1-100).Default: 30Range: 1-100
skipqueryintegerNumber of records to skip before returning results.Default: 0Range: 0-1000000
selectquerystringComma-separated list of fields to return. id is always included. Allowed: id, body, postId, userId, likes.
sortByquerystringField to sort by.One of: id, likes, postId, userIdDefault: id
orderquerystringSort direction.One of: asc, descDefault: asc
postIdqueryintegerOnly return comments on this post ID.
userIdqueryintegerOnly return comments that belong to this user ID.
delayqueryintegerDelay 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, and limit metadata.
  • 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.

200application/json
{
  "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
Headers

No header yet.

Open in playground
Send the request to see a live response.

Get a comment

GET/api/v1/comments/{id}

Returns a single comment by its numeric ID.

Parameters

Parameters for Get a comment
NameInTypeDescription
idrequiredpathintegerNumeric comment ID (positive integer).Min: 1
selectquerystringComma-separated list of fields to return. id is always included. Allowed: id, body, postId, userId, likes.
delayqueryintegerDelay 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.

200application/json
{
  "id": 1,
  "body": "Do you have any recommendations for someone just starting out?",
  "postId": 1,
  "userId": 87,
  "likes": 9
}

Try it

GET
Headers

No header yet.

Open in playground
Send the request to see a live response.

Create a comment (simulated)

POST/api/v1/comments
Simulated - not persisted

Validates 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

Headers for Create a comment (simulated)
NameInTypeDescription
Content-TyperequiredheaderstringMust be application/json.

Request body

Comments fields.

Body fields for Create a comment (simulated)
FieldTypeRequiredNotes
bodystringYesmin length 1, max length 2000
postIdintegerYesmin 0, max 1000000000
userIdintegerYesmin 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.

201application/json
{
  "id": 301,
  "body": "Great write-up, thanks for sharing!",
  "postId": 1,
  "userId": 3,
  "likes": 0
}

Try it

POST
Headers
Open in playground
Send the request to see a live response.

Replace a comment (simulated)

PUT/api/v1/comments/{id}
Simulated - not persisted

Validates a complete replacement body and returns the resulting comment. The stored record is not changed.

Parameters

Parameters for Replace a comment (simulated)
NameInTypeDescription
idrequiredpathintegerNumeric comment ID (positive integer).Min: 1

Headers

Headers for Replace a comment (simulated)
NameInTypeDescription
Content-TyperequiredheaderstringMust be application/json.

Request body

Complete comment representation.

Body fields for Replace a comment (simulated)
FieldTypeRequiredNotes
bodystringYesmin length 1, max length 2000
postIdintegerYesmin 0, max 1000000000
userIdintegerYesmin 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.

200application/json
{
  "id": 1,
  "body": "Edited comment text.",
  "postId": 1,
  "userId": 3,
  "likes": 0
}

Try it

PUT
Headers
Open in playground
Send the request to see a live response.

Update a comment (simulated)

PATCH/api/v1/comments/{id}
Simulated - not persisted

Merges the provided fields into the existing comment and returns the result. The stored record is not changed.

Parameters

Parameters for Update a comment (simulated)
NameInTypeDescription
idrequiredpathintegerNumeric comment ID (positive integer).Min: 1

Headers

Headers for Update a comment (simulated)
NameInTypeDescription
Content-TyperequiredheaderstringMust be application/json.

Request body

Any subset of comment fields.

Body fields for Update a comment (simulated)
FieldTypeRequiredNotes
bodystringNomin length 1, max length 2000
postIdintegerNomin 0, max 1000000000
userIdintegerNomin 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.

200application/json
{
  "id": 1,
  "body": "Edited comment text.",
  "postId": 1,
  "userId": 87,
  "likes": 9
}

Try it

PATCH
Headers
Open in playground
Send the request to see a live response.

Delete a comment (simulated)

DELETE/api/v1/comments/{id}
Simulated - not persisted

Returns 204 No Content if the comment exists. The record is not actually removed.

Parameters

Parameters for Delete a comment (simulated)
NameInTypeDescription
idrequiredpathintegerNumeric 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.

204no content

No response body.

Try it

DELETE
Headers

No header yet.

Open in playground
Send the request to see a live response.