Posts Resource Documentation
Read operations merge shared global posts with your session's overlay (newly created posts appear at the top, updates apply in-place, deletes are filtered). Each post belongs to a user (`user_id` foreign key). Mutations are session-scoped and capped at 30 created records.
Retrieve a paginated list of posts. Results merge shared global posts with session sandbox overlays (newly created posts 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/posts' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid"
fetch('http://localhost:3000/posts', {
method: 'GET',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.get('http://localhost:3000/posts', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.get('http://localhost:3000/posts')
print(response.json())
Response Schema Example
{
"data": [
{
"id": "local-b2c3d4e5-f6a7-8901-bcde-f12345678901",
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"_sandbox": "created"
},
{
"id": 1,
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 101,
"totalPages": 11,
"hasNextPage": true,
"hasPrevPage": false
}
}
⚡ Try it out — Test endpoint live Run fetch
Retrieve a single post 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 | Post ID (e.g. 1 for global post or local-<uuid> for sandbox post). |
curl -X GET 'http://localhost:3000/posts/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid"
fetch('http://localhost:3000/posts/:id', {
method: 'GET',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.get('http://localhost:3000/posts/:id', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.get('http://localhost:3000/posts/:id')
print(response.json())
Response Schema Example
{
"id": 1,
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}
⚡ Try it out — Test endpoint live Run fetch
Create a new session sandbox post record. Returns a local-<uuid> formatted ID with _sandbox: 'created'. Each session identity is capped at 30 created records.
| Name | Type | Location | Description |
|---|---|---|---|
user_id |
integer |
body | Author user ID. |
title |
string |
body | Post title. |
body |
string |
body | Post body text content. |
curl -X POST 'http://localhost:3000/posts' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid" \
-d '{
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}'
fetch('http://localhost:3000/posts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "user_id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto" })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.post('http://localhost:3000/posts', { "user_id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto" }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "user_id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto" }
response = requests.post('http://localhost:3000/posts', json=payload)
print(response.json())
Request Payload Example
{
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}
Response Schema Example
{
"id": "local-b2c3d4e5-f6a7-8901-bcde-f12345678901",
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto",
"_sandbox": "created"
}
⚡ Try it out — Test endpoint live Run fetch
Replace an existing post 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 | Post ID to update (e.g. 1 or local-<uuid>). |
curl -X PUT 'http://localhost:3000/posts/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid" \
-d '{
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}'
fetch('http://localhost:3000/posts/:id', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "user_id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)", "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto" })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.put('http://localhost:3000/posts/:id', { "user_id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)", "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto" }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "user_id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)", "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto" }
response = requests.put('http://localhost:3000/posts/:id', json=payload)
print(response.json())
Request Payload Example
{
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}
Response Schema Example
{
"id": 1,
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto",
"_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
Partially update specific fields of a post record in the session overlay.
| Name | Type | Location | Description |
|---|---|---|---|
id |
string | integer |
path | Post ID to patch (e.g. 1 or local-<uuid>). |
curl -X PATCH 'http://localhost:3000/posts/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid" \
-d '{
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)"
}'
fetch('http://localhost:3000/posts/:id', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)" })
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.patch('http://localhost:3000/posts/:id', { "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)" }, {
withCredentials: true
}).then(response => console.log(response.data));
import requests
payload = { "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)" }
response = requests.patch('http://localhost:3000/posts/:id', json=payload)
print(response.json())
Request Payload Example
{
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)"
}
Response Schema Example
{
"id": 1,
"user_id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
"body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto",
"_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
Remove a post record from the requesting session view. The underlying global record is unaffected for other visitors.
| Name | Type | Location | Description |
|---|---|---|---|
id |
string | integer |
path | Post ID to delete (e.g. 1 or local-<uuid>). |
curl -X DELETE 'http://localhost:3000/posts/:id' \
-H 'Content-Type: application/json' \
-b "pg_identity=your_cookie_uuid"
fetch('http://localhost:3000/posts/:id', {
method: 'DELETE',
credentials: 'include'
})
.then(res => res.json())
.then(data => console.log(data));
import axios from 'axios';
axios.delete('http://localhost:3000/posts/:id', {
withCredentials: true
}).then(response => console.log(response.data));
import requests
response = requests.delete('http://localhost:3000/posts/:id')
print(response.status_code)
Response Schema Example
204 No Content