Posts Posts API

50 tech blog posts with tags and reactions.

Get all posts

Get all posts (paginated).
fetch('https://axomock.fauzantaslim.biz.id/api/posts')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/posts')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/posts
200 OK
{
  "posts": [
    {
      "id": 1,
      "title": "The future of web development in 2025",
      "body": "Web development continues to evolve at a rapid pace...",
      "userId": 1,
      "tags": [
        "webdev",
        "javascript",
        "frontend"
      ],
      "reactions": {
        "likes": 142,
        "dislikes": 7
      }
    },
    ... // 29 more items
  ],
  "total": 50,
  "skip": 0,
  "limit": 30
}

Get a single post

Get a single post by ID.
fetch('https://axomock.fauzantaslim.biz.id/api/posts/1')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/posts/1')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/posts/1
200 OK
{
  "id": 1,
  "title": "The future of web development in 2025",
  "body": "Web development continues to evolve at a rapid pace. From server components to edge computing, developers are embracing new paradigms that fundamentally change how we build applications. The shift toward server-side rendering with frameworks like Next.js and Remix has been particularly notable.",
  "userId": 1,
  "tags": [
    "webdev",
    "javascript",
    "frontend"
  ],
  "reactions": {
    "likes": 142,
    "dislikes": 7
  }
}

Search posts

Search posts by title or body text.
fetch('https://axomock.fauzantaslim.biz.id/api/posts/search?q=react')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/posts/search?q=react')
  .then(res => console.log(res.data));
curl "https://axomock.fauzantaslim.biz.id/api/posts/search?q=react"
200 OK
{
  "posts": [
    {
      "id": 8,
      "title": "React hooks deep dive",
      ...
    }
  ],
  "total": 3,
  "skip": 0,
  "limit": 30
}

Get post comments

Get all comments for a specific post.
fetch('https://axomock.fauzantaslim.biz.id/api/posts/1/comments')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/posts/1/comments')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/posts/1/comments
200 OK
{
  "comments": [
    {
      "id": 1,
      "body": "Great article! I've been using these principles in my projects and they really make a difference.",
      "postId": 1,
      ...
    }
  ],
  "total": 2,
  "skip": 0,
  "limit": 30
}

Filter posts by tag

Get posts filtered by tag name (e.g., javascript).
fetch('https://axomock.fauzantaslim.biz.id/api/posts/tag/javascript')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/posts/tag/javascript')
  .then(res => console.log(res.data));
curl https://axomock.fauzantaslim.biz.id/api/posts/tag/javascript
200 OK
{
  "posts": [
    {
      "id": 1,
      "title": "The future of web development in 2025",
      "tags": [
        "webdev",
        "javascript",
        "frontend"
      ],
      ...
    }
  ],
  "total": 5,
  "skip": 0,
  "limit": 30
}

Limit and skip posts

You can pass limit and skip params to limit and skip the results for pagination.
fetch('https://axomock.fauzantaslim.biz.id/api/posts?limit=10&skip=10')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/posts?limit=10&skip=10')
  .then(res => console.log(res.data));
curl "https://axomock.fauzantaslim.biz.id/api/posts?limit=10&skip=10"
200 OK
{
  "posts": [
    ...
  ],
  "total": 50,
  "skip": 10,
  "limit": 10
}

Sort posts

You can pass sortBy and order params to sort the results.
fetch('https://axomock.fauzantaslim.biz.id/api/posts?sortBy=title&order=asc')
  .then(res => res.json())
  .then(console.log);
axios.get('https://axomock.fauzantaslim.biz.id/api/posts?sortBy=title&order=asc')
  .then(res => console.log(res.data));
curl "https://axomock.fauzantaslim.biz.id/api/posts?sortBy=title&order=asc"
200 OK
{
  "posts": [
    ...
  ],
  "total": 50,
  "skip": 0,
  "limit": 30
}

Create a post

Adding a new post will not add it into the server. It will simulate a POST request and will return the new created post with a new id.
fetch('https://axomock.fauzantaslim.biz.id/api/posts', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    title: 'New post title',
    body: 'This is the body of the new post',
    userId: 5
  })
})
.then(res => res.json())
.then(console.log);
axios.post('https://axomock.fauzantaslim.biz.id/api/posts', {
  title: 'New post title',
  body: 'This is the body of the new post',
  userId: 5
})
.then(res => console.log(res.data));
curl -X POST https://axomock.fauzantaslim.biz.id/api/posts \
-H "Content-Type: application/json" \
-d '{"title":"New post title","body":"This is the body of the new post","userId":5}'
201 Created
{
  "id": 51,
  "title": "New post title",
  "body": "This is the body of the new post",
  "userId": 5,
  "tags": [],
  "reactions": {
    "likes": 0,
    "dislikes": 0
  }
}

Update a post

Updating a post will not update it into the server. It will simulate a PUT/PATCH request and will return the updated post.
fetch('https://axomock.fauzantaslim.biz.id/api/posts/1', {
  method: 'PUT', /* or PATCH */
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    title: 'Updated post title'
  })
})
.then(res => res.json())
.then(console.log);
axios.put('https://axomock.fauzantaslim.biz.id/api/posts/1', {
  title: 'Updated post title'
})
.then(res => console.log(res.data));
curl -X PUT https://axomock.fauzantaslim.biz.id/api/posts/1 \
-H "Content-Type: application/json" \
-d '{"title":"Updated post title"}'
200 OK
{
  "id": 1,
  "title": "Updated post title",
  ...
}

Delete a post

Deleting a post will not delete it into the server. It will simulate a DELETE request and will return deleted post.
fetch('https://axomock.fauzantaslim.biz.id/api/posts/1', {
  method: 'DELETE',
})
.then(res => res.json())
.then(console.log);
axios.delete('https://axomock.fauzantaslim.biz.id/api/posts/1')
.then(res => console.log(res.data));
curl -X DELETE https://axomock.fauzantaslim.biz.id/api/posts/1
200 OK
{
  "id": 1,
  "title": "The future of web development in 2025",
  ...,
  "isDeleted": true,
  "deletedOn": "2026-07-08T05:42:00.000Z"
}