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
/commentsReturns 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
| Name | Type | Default | Description |
|---|---|---|---|
| page | number | 1 | Page number for pagination. |
| limit | number | 20 | Number of items per page. |
| search | string | — | Search 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/:idReturns 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
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Required | The 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