Resource reference
Comments
Post comments with author details and a nested post summary.
Data model
Comments schema
Responses include the following fields. Read-only values are generated by the API.
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | Read only | Auto-incrementing resource identifier. |
name | string | Required | Comment subject or author label, 1 to 100 characters. |
email | email string | Required | Valid author email address. |
body | string | Required | Comment text, 1 to 1,000 characters. |
postId | integer | Required | Parent post ID. |
post | object | Read only | Nested parent post ID and title. |
createdAt | ISO 8601 string | Read only | Time the record was created. |
updatedAt | ISO 8601 string | Read only | Time the record was last updated. |
Example object
A complete comment
{
"id": 1,
"name": "A useful response",
"email": "reader@example.com",
"body": "This explanation made the implementation much clearer.",
"postId": 1,
"createdAt": "2026-07-22T00:00:03.599Z",
"updatedAt": "2026-07-22T00:00:03.599Z",
"post": {
"id": 1,
"title": "Getting Started with Modern Web Development: A Practical First Project"
}
}Endpoints
Read and write comments
Every example uses the shared free API. Replace :id with a numeric record ID.
GET/comments
List comments
Returns paginated comments with a nested post summary.
curl 'https://api.apimocker.com/comments'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
_page or page | integer | Optional | Page number. Defaults to 1. |
_limit or limit | integer | Optional | Items per page. Defaults to 10 and is capped at 100. |
_sort | string | Optional | Field used for sorting. Defaults to id. |
_order | asc | desc | Optional | Sort direction. Defaults to asc. |
_delay | integer | Optional | Artificial response delay in milliseconds. |
body_like | string | Optional | Partial, case-insensitive body match. |
email | string | Optional | Exact email match. |
Example response
{
"data": [
{
"id": 1,
"name": "A useful response",
"email": "reader@example.com",
"body": "This explanation made the implementation much clearer.",
"postId": 1,
"createdAt": "2026-07-22T00:00:03.599Z",
"updatedAt": "2026-07-22T00:00:03.599Z",
"post": {
"id": 1,
"title": "Getting Started with Modern Web Development: A Practical First Project"
}
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 500,
"totalPages": 50,
"hasNext": true,
"hasPrev": false
}
}GET/comments/search?q=clearer
Search comments
Searches name, email, and body and returns up to 10 matches.
curl 'https://api.apimocker.com/comments/search?q=clearer'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Required | Case-insensitive search text. |
_delay | integer | Optional | Artificial response delay in milliseconds. |
Example response
{
"query": "clearer",
"total": 1,
"results": [
{
"id": 1,
"name": "A useful response",
"email": "reader@example.com",
"body": "This explanation made the implementation much clearer.",
"postId": 1,
"createdAt": "2026-07-22T00:00:03.599Z",
"updatedAt": "2026-07-22T00:00:03.599Z",
"post": {
"id": 1,
"title": "Getting Started with Modern Web Development: A Practical First Project"
}
}
]
}GET/comments/:id
Get one comment
Returns a comment directly with its nested post summary.
curl 'https://api.apimocker.com/comments/1'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Required | The resource ID from the URL path. |
_delay | integer | Optional | Artificial response delay in milliseconds. |
Example response
{
"id": 1,
"name": "A useful response",
"email": "reader@example.com",
"body": "This explanation made the implementation much clearer.",
"postId": 1,
"createdAt": "2026-07-22T00:00:03.599Z",
"updatedAt": "2026-07-22T00:00:03.599Z",
"post": {
"id": 1,
"title": "Getting Started with Modern Web Development: A Practical First Project"
}
}POST/comments
Create a comment
Creates a comment for an existing post.
curl -X POST 'https://api.apimocker.com/comments' \
-H 'Content-Type: application/json' \
-d '{ "name": "Helpful article", "email": "reader@example.com", "body": "This was useful.", "postId": 1 }'Request body
{
"name": "Helpful article",
"email": "reader@example.com",
"body": "This was useful.",
"postId": 1
}Example response
{
"id": 1,
"name": "A useful response",
"email": "reader@example.com",
"body": "This explanation made the implementation much clearer.",
"postId": 1,
"createdAt": "2026-07-22T00:00:03.599Z",
"updatedAt": "2026-07-22T00:00:03.599Z",
"post": {
"id": 1,
"title": "Getting Started with Modern Web Development: A Practical First Project"
}
}- Writes affect the shared dataset until the next daily reset.
- Unknown fields are rejected by the database layer.
PUT/comments/:id
Replace a comment
Updates a comment. Name, email, body, and postId are required.
curl -X PUT 'https://api.apimocker.com/comments/1' \
-H 'Content-Type: application/json' \
-d '{ "name": "Updated comment", "email": "reader@example.com", "body": "The updated response.", "postId": 1 }'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Required | The resource ID from the URL path. |
Request body
{
"name": "Updated comment",
"email": "reader@example.com",
"body": "The updated response.",
"postId": 1
}Example response
{
"id": 1,
"name": "A useful response",
"email": "reader@example.com",
"body": "This explanation made the implementation much clearer.",
"postId": 1,
"createdAt": "2026-07-22T00:00:03.599Z",
"updatedAt": "2026-07-22T00:00:03.599Z",
"post": {
"id": 1,
"title": "Getting Started with Modern Web Development: A Practical First Project"
}
}- Writes affect the shared dataset until the next daily reset.
- Unknown fields are rejected by the database layer.
PATCH/comments/:id
Update selected comment fields
Updates only the provided fields.
curl -X PATCH 'https://api.apimocker.com/comments/1' \
-H 'Content-Type: application/json' \
-d '{ "body": "A corrected response." }'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Required | The resource ID from the URL path. |
Request body
{
"body": "A corrected response."
}Example response
{
"id": 1,
"name": "A useful response",
"email": "reader@example.com",
"body": "This explanation made the implementation much clearer.",
"postId": 1,
"createdAt": "2026-07-22T00:00:03.599Z",
"updatedAt": "2026-07-22T00:00:03.599Z",
"post": {
"id": 1,
"title": "Getting Started with Modern Web Development: A Practical First Project"
}
}- Writes affect the shared dataset until the next daily reset.
- Unknown fields are rejected by the database layer.
DELETE/comments/:id
Delete a comment
Deletes the comment permanently until the next reset.
curl -X DELETE 'https://api.apimocker.com/comments/1'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Required | The resource ID from the URL path. |
- Writes affect the shared dataset until the next daily reset.
- Unknown fields are rejected by the database layer.