DummyAPI
DocsComments

Comments API

The comments endpoint provides a dataset of sample user comments, including details like usernames, post IDs, and comment texts, ideal for testing and prototyping social interactions and feedback features in web applications.

GET/comments

Returns a paginated list of comments.

Code Examples

fetch
fetch('https://api.dhanyalvian.my.id/dummy/v1/comments', {
  headers: { 'Content-Type': 'application/json' }
})
  .then(res => res.json())
  .then(data => console.log(data))
  .catch(err => console.error(err));
URL
https://api.dhanyalvian.my.id/dummy/v1/comments
Query Parameters
NameTypeDefaultDescription
pagenumber1Page number for pagination.
limitnumber20Number of items per page.
searchstringSearch by body.
Response (200 OK)
{
  "meta": {
    "reqId": "202722ce-0d5e-4745-a8c1-b7ab7a245972",
    "code": "200"
  },
  "message": "",
  "pagination": {
    "page": 1,
    "next": 2,
    "record": 1,
    "totalPage": 100,
    "totalRecord": 100
  },
  "records": [
    {
      "id": "100",
      "user_id": "228",
      "post_id": "100",
      "body": "Eventual consistency in distributed systems is well explained.",
      "likes": 37
    }
  ]
}

Try it Yourself

GET
Query Params
page:
limit:
search:
GET/comments/:id

Returns a single comment by ID.

Code Examples

fetch
fetch('https://api.dhanyalvian.my.id/dummy/v1/comments/1', {
  headers: { 'Content-Type': 'application/json' }
})
  .then(res => res.json())
  .then(data => console.log(data))
  .catch(err => console.error(err));
URL
https://api.dhanyalvian.my.id/dummy/v1/comments/:id
Path Parameters
NameTypeRequiredDescription
idstringRequiredThe unique identifier of the comment.
Response (200 OK)
{
  "meta": {
    "reqId": "212722ce-0d5e-4745-a8c1-b7ab7a245972",
    "code": "200"
  },
  "message": "",
  "record": {
    "id": "1",
    "user_id": "49",
    "post_id": "1",
    "body": "Great article! The CQRS pattern explanation is very clear and easy to understand.",
    "likes": 15
  }
}
Error Response
{
  "meta": {
    "reqId": "4a16367e-66bc-4d5c-8ac1-c7e2eb294724",
    "code": "400"
  },
  "message": "Data not found"
}

Try it Yourself

GET