Comments Resource Documentation
Read operations merge shared global comments with your session's overlay (newly created comments appear at the top, updates apply in-place, deletes are filtered). Each comment belongs to a post (`post_id` foreign key). Mutations are session-scoped and capped at 30 created records.
Retrieve a paginated list of comments. Results merge shared global comments with session sandbox overlays (newly created comments appear at the top).
| Name | Type | Location | Description |
|---|---|---|---|
page |
integer |
query | Page number (1-indexed, default 1). |
limit |
integer |
query | Number of records per page (default 10, max 30). |
curl -X GET 'http://localhost:3000/comments' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid"
fetch('http://localhost:3000/comments', {
method: 'GET',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.get('http://localhost:3000/comments', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.get('http://localhost:3000/comments')
print(response.json())
Response Schema Example
{
"data": [
{
"id": "local-c3d4e5f6-7890-abcd-ef12-345678901234",
"post_id": 1,
"name": "id labore ex et quam laborum",
"_sandbox": "created"
},
{
"id": 1,
"post_id": 1,
"name": "id labore ex et quam laborum",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 301,
"totalPages": 31,
"hasNextPage": true,
"hasPrevPage": false
}
}
⚡ Try it out — Test endpoint live Run fetch
Retrieve a single comment by ID. Supports plain integer IDs for global records (e.g. 1) and string IDs formatted as local-<uuid> for session sandbox records.
| Name | Type | Location | Description |
|---|---|---|---|
id |
string | integer |
path | Comment ID (e.g. 1 for global comment or local-<uuid> for sandbox comment). |
curl -X GET 'http://localhost:3000/comments/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid"
fetch('http://localhost:3000/comments/:id', {
method: 'GET',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.get('http://localhost:3000/comments/:id', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.get('http://localhost:3000/comments/:id')
print(response.json())
Response Schema Example
{
"id": 1,
"post_id": 1,
"name": "id labore ex et quam laborum",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus"
}
⚡ Try it out — Test endpoint live Run fetch
Create a new session sandbox comment record. Returns a local-<uuid> formatted ID with _sandbox: 'created'. Each session identity is capped at 30 created records.
| Name | Type | Location | Description |
|---|---|---|---|
post_id |
integer |
body | Target post ID. |
name |
string |
body | Comment title or reviewer name. |
email |
string |
body | Commenter email address. |
body |
string |
body | Comment text content. |
curl -X POST 'http://localhost:3000/comments' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid" \
-d '{
"post_id": 1,
"name": "id labore ex et quam laborum",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus"
}'
fetch('http://localhost:3000/comments', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "post_id": 1, "name": "id labore ex et quam laborum", "email": "Eliseo@gardner.biz", "body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus" })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.post('http://localhost:3000/comments', { "post_id": 1, "name": "id labore ex et quam laborum", "email": "Eliseo@gardner.biz", "body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus" }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "post_id": 1, "name": "id labore ex et quam laborum", "email": "Eliseo@gardner.biz", "body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus" }
response = requests.post('http://localhost:3000/comments', json=payload)
print(response.json())
Request Payload Example
{
"post_id": 1,
"name": "id labore ex et quam laborum",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus"
}
Response Schema Example
{
"id": "local-c3d4e5f6-7890-abcd-ef12-345678901234",
"post_id": 1,
"name": "id labore ex et quam laborum",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus",
"_sandbox": "created"
}
⚡ Try it out — Test endpoint live Run fetch
Replace an existing comment record in the session overlay. Global records remain untouched for other visitors and preserve original list position.
| Name | Type | Location | Description |
|---|---|---|---|
id |
string | integer |
path | Comment ID to update (e.g. 1 or local-<uuid>). |
curl -X PUT 'http://localhost:3000/comments/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid" \
-d '{
"post_id": 1,
"name": "id labore ex et quam laborum (Updated)",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus"
}'
fetch('http://localhost:3000/comments/:id', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "post_id": 1, "name": "id labore ex et quam laborum (Updated)", "email": "Eliseo@gardner.biz", "body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus" })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.put('http://localhost:3000/comments/:id', { "post_id": 1, "name": "id labore ex et quam laborum (Updated)", "email": "Eliseo@gardner.biz", "body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus" }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "post_id": 1, "name": "id labore ex et quam laborum (Updated)", "email": "Eliseo@gardner.biz", "body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus" }
response = requests.put('http://localhost:3000/comments/:id', json=payload)
print(response.json())
Request Payload Example
{
"post_id": 1,
"name": "id labore ex et quam laborum (Updated)",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus"
}
Response Schema Example
{
"id": 1,
"post_id": 1,
"name": "id labore ex et quam laborum (Updated)",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus",
"_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
Partially update specific fields of a comment record in the session overlay.
| Name | Type | Location | Description |
|---|---|---|---|
id |
string | integer |
path | Comment ID to patch (e.g. 1 or local-<uuid>). |
curl -X PATCH 'http://localhost:3000/comments/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid" \
-d '{
"name": "id labore ex et quam laborum (Updated)"
}'
fetch('http://localhost:3000/comments/:id', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "name": "id labore ex et quam laborum (Updated)" })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.patch('http://localhost:3000/comments/:id', { "name": "id labore ex et quam laborum (Updated)" }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "name": "id labore ex et quam laborum (Updated)" }
response = requests.patch('http://localhost:3000/comments/:id', json=payload)
print(response.json())
Request Payload Example
{
"name": "id labore ex et quam laborum (Updated)"
}
Response Schema Example
{
"id": 1,
"post_id": 1,
"name": "id labore ex et quam laborum (Updated)",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptatem aut eveniet quas aliquid sint expedita consequuntur alias ea quam expedita possimus",
"_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
Remove a comment record from the requesting session view. The underlying global record is unaffected for other visitors.
| Name | Type | Location | Description |
|---|---|---|---|
id |
string | integer |
path | Comment ID to delete (e.g. 1 or local-<uuid>). |
curl -X DELETE 'http://localhost:3000/comments/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid"
fetch('http://localhost:3000/comments/:id', {
method: 'DELETE',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.delete('http://localhost:3000/comments/:id', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.delete('http://localhost:3000/comments/:id')
print(response.status_code)
Response Schema Example
204 No Content