Skip to content
Mock APIs

Resources

Posts

Short blog-style posts written by seeded users, with tags, reactions, and view counts. The dataset contains 100 posts.

Writes are simulated

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

Endpoints

The post object

Use select to return a subset of these fields. Sort with sortBy on id, title, views, userId; search matches title, body, tags. See query parameters.

post fields
FieldTypeNotes
idintegermin -9007199254740991, max 9007199254740991
titlestring
bodystring
userIdintegermin -9007199254740991, max 9007199254740991
tagsstring[]
reactionsobject
reactions.likesintegermin -9007199254740991, max 9007199254740991
reactions.dislikesintegermin -9007199254740991, max 9007199254740991
viewsintegermin -9007199254740991, max 9007199254740991

List posts

GET/api/v1/posts

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

Parameters

Parameters for List posts
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, title, body, userId, tags, reactions, views.
sortByquerystringField to sort by.One of: id, title, views, userIdDefault: id
orderquerystringSort direction.One of: asc, descDefault: asc
userIdqueryintegerOnly return posts that belong to this user ID.
tagquerystringOnly return posts with this tag.
delayqueryintegerDelay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000

Status codes

  • 200A page of posts 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/posts?limit=2'

Example responses

Captured from the real API with the requests shown on this page.

200application/json
{
  "posts": [
    {
      "id": 1,
      "title": "Why I write tests before fixing bugs",
      "body": "Writing the failing test first made the bug impossible to ignore. Pairing for an hour was faster than a day of back-and-forth messages. Clear error messages turned out to be the best documentation we had.",
      "userId": 1,
      "tags": [
        "coding",
        "weekend"
      ],
      "reactions": {
        "likes": 398,
        "dislikes": 28
      },
      "views": 1472
    },
    {
      "id": 2,
      "title": "My slow Sunday pour-over routine",
      "body": "Sharing a pot with neighbors turned into a weekly tradition. Fresh water and a clean kettle make a bigger difference than I expected. Weighing the beans felt fussy at first, but the cups became noticeably more consistent.",
      "userId": 1,
      "tags": [
        "coffee",
        "learning",
        "beginners"
      ],
      "reactions": {
        "likes": 330,
        "dislikes": 8
      },
      "views": 1187
    }
  ],
  "total": 100,
  "skip": 0,
  "limit": 2
}

Try it

GET
Headers

No header yet.

Open in playground
Send the request to see a live response.
GET/api/v1/posts/search

Case-insensitive search across title, body, tags. Returns an empty posts array with total: 0 when nothing matches.

Parameters

Parameters for Search posts
NameInTypeDescription
qrequiredquerystringSearch term (1-100 characters).
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, title, body, userId, tags, reactions, views.
sortByquerystringField to sort by.One of: id, title, views, userIdDefault: id
orderquerystringSort direction.One of: asc, descDefault: asc
delayqueryintegerDelay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000

Status codes

  • 200Matching posts (possibly empty).
  • 400Missing or invalid q parameter (INVALID_PARAMETER).
  • 429Too many requests from this IP (RATE_LIMIT_EXCEEDED).

Request

curl 'https://test.naimulhassan.me/api/v1/posts/search?q=coffee&limit=2'

Example responses

Captured from the real API with the requests shown on this page.

200application/json
{
  "posts": [
    {
      "id": 2,
      "title": "My slow Sunday pour-over routine",
      "body": "Sharing a pot with neighbors turned into a weekly tradition. Fresh water and a clean kettle make a bigger difference than I expected. Weighing the beans felt fussy at first, but the cups became noticeably more consistent.",
      "userId": 1,
      "tags": [
        "coffee",
        "learning",
        "beginners"
      ],
      "reactions": {
        "likes": 330,
        "dislikes": 8
      },
      "views": 1187
    },
    {
      "id": 12,
      "title": "Finding the right grind size by taste",
      "body": "I wrote down every recipe change in a small notebook for a month. Fresh water and a clean kettle make a bigger difference than I expected. Sharing a pot with neighbors turned into a weekly tradition.",
      "userId": 22,
      "tags": [
        "coffee",
        "habits"
      ],
      "reactions": {
        "likes": 834,
        "dislikes": 22
      },
      "views": 3371
    }
  ],
  "total": 10,
  "skip": 0,
  "limit": 2
}

Try it

GET
Headers

No header yet.

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

Get a post

GET/api/v1/posts/{id}

Returns a single post by its numeric ID.

Parameters

Parameters for Get a post
NameInTypeDescription
idrequiredpathintegerNumeric post ID (positive integer).Min: 1
selectquerystringComma-separated list of fields to return. id is always included. Allowed: id, title, body, userId, tags, reactions, views.
delayqueryintegerDelay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000

Status codes

  • 200The post 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/posts/1'

Example responses

Captured from the real API with the requests shown on this page.

200application/json
{
  "id": 1,
  "title": "Why I write tests before fixing bugs",
  "body": "Writing the failing test first made the bug impossible to ignore. Pairing for an hour was faster than a day of back-and-forth messages. Clear error messages turned out to be the best documentation we had.",
  "userId": 1,
  "tags": [
    "coding",
    "weekend"
  ],
  "reactions": {
    "likes": 398,
    "dislikes": 28
  },
  "views": 1472
}

Try it

GET
Headers

No header yet.

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

List a post's comments

GET/api/v1/posts/{id}/comments

Returns comments whose postId matches the post ID. Returns 404 if the post does not exist.

Parameters

Parameters for List a post's comments
NameInTypeDescription
idrequiredpathintegerNumeric post ID (positive integer).Min: 1
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
delayqueryintegerDelay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000

Status codes

  • 200A page of comments.
  • 400Invalid path or query parameter (INVALID_PARAMETER / INVALID_ID).
  • 404The post does not exist (RESOURCE_NOT_FOUND).

Request

curl 'https://test.naimulhassan.me/api/v1/posts/1/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": 261,
      "body": "Could you share more details about how you got started?",
      "postId": 1,
      "userId": 28,
      "likes": 50
    }
  ],
  "total": 4,
  "skip": 0,
  "limit": 2
}

Try it

GET
Headers

No header yet.

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

Create a post (simulated)

POST/api/v1/posts
Simulated - not persisted

Validates the body and returns the post as it would be created, with the next available ID. Nothing is persisted: the shared dataset is never modified.

Headers

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

Request body

Posts fields.

Body fields for Create a post (simulated)
FieldTypeRequiredNotes
titlestringYesmin length 1, max length 200
bodystringYesmin length 1, max length 5000
userIdintegerYesmin 0, max 1000000000
tagsstring[]No

Status codes

  • 201The simulated post, 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/posts' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "My first API request",
  "body": "Today I sent my first request to Mock APIs.",
  "userId": 5
}'

Example responses

Captured from the real API with the requests shown on this page.

201application/json
{
  "id": 101,
  "title": "My first API request",
  "body": "Today I sent my first request to Mock APIs.",
  "userId": 5,
  "tags": []
}

Try it

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

Replace a post (simulated)

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

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

Parameters

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

Headers

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

Request body

Complete post representation.

Body fields for Replace a post (simulated)
FieldTypeRequiredNotes
titlestringYesmin length 1, max length 200
bodystringYesmin length 1, max length 5000
userIdintegerYesmin 0, max 1000000000
tagsstring[]No

Status codes

  • 200The replaced post.
  • 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/posts/1' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Updated title",
  "body": "Completely replaced body text.",
  "userId": 1,
  "tags": [
    "update"
  ]
}'

Example responses

Captured from the real API with the requests shown on this page.

200application/json
{
  "id": 1,
  "title": "Updated title",
  "body": "Completely replaced body text.",
  "userId": 1,
  "tags": [
    "update"
  ]
}

Try it

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

Update a post (simulated)

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

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

Parameters

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

Headers

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

Request body

Any subset of post fields.

Body fields for Update a post (simulated)
FieldTypeRequiredNotes
titlestringNomin length 1, max length 200
bodystringNomin length 1, max length 5000
userIdintegerNomin 0, max 1000000000
tagsstring[]No

Status codes

  • 200The updated post.
  • 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/posts/1' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Patched title"
}'

Example responses

Captured from the real API with the requests shown on this page.

200application/json
{
  "id": 1,
  "title": "Patched title",
  "body": "Writing the failing test first made the bug impossible to ignore. Pairing for an hour was faster than a day of back-and-forth messages. Clear error messages turned out to be the best documentation we had.",
  "userId": 1,
  "tags": [
    "coding",
    "weekend"
  ],
  "reactions": {
    "likes": 398,
    "dislikes": 28
  },
  "views": 1472
}

Try it

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

Delete a post (simulated)

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

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

Parameters

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