GraphQL Schema Documentation
Posts GraphQL API
Query, mutate, and filter Post entities with relational author and comment data via GraphQL.
Get all posts
Fetch a list of posts from global seed data merged with identity sandbox overlays.
Query / Mutation
1
query GetAllPosts {
2
posts {
3
id
4
title
5
body
6
user_id
7
}
8
}
Response JSON
1
{
2
"data": {
3
"posts": [
4
{
5
"id": "1",
6
"title": "Getting Started with Playground API",
7
"body": "Playground API provides instant sandboxed mock endpoints...",
8
"user_id": "1"
9
},
10
{
11
"id": "2",
12
"title": "Building React Apps with Sandboxed APIs",
13
"body": "Test mutations without touching backend databases...",
14
"user_id": "1"
15
}
16
]
17
}
18
}
Get a single post
Retrieve details of a specific post by integer ID or local sandbox string ID.
Query / Mutation
1
query GetSinglePost {
2
post(id: "1") {
3
id
4
title
5
body
6
user_id
7
}
8
}
Response JSON
1
{
2
"data": {
3
"post": {
4
"id": "1",
5
"title": "Getting Started with Playground API",
6
"body": "Playground API provides instant sandboxed mock endpoints...",
7
"user_id": "1"
8
}
9
}
10
}
Get post with nested user and comments
Perform multi-level relational selection fetching author user profile and comments list in one request.
Query / Mutation
1
query GetPostWithRelations {
2
post(id: "1") {
3
id
4
title
5
user {
6
id
7
name
8
email
9
}
10
comments {
11
id
12
name
13
email
14
body
15
}
16
}
17
}
Response JSON
1
{
2
"data": {
3
"post": {
4
"id": "1",
5
"title": "Getting Started with Playground API",
6
"user": {
7
"id": "1",
8
"name": "Leanne Graham",
9
"email": "Sincere@april.biz"
10
},
11
"comments": [
12
{
13
"id": "1",
14
"name": "id labore ex et quam laborum",
15
"email": "Eliseo@gardner.biz",
16
"body": "laudantium enim quasi est quidem magnam voluptate ipsam eos"
17
}
18
]
19
}
20
}
21
}
Create a post
Execute a createPost mutation. The created post is stored in your identity session sandbox overlay and prepended to posts list.
Query / Mutation
1
mutation CreatePost {
2
createPost(user_id: "1", title: "New Sandboxed GraphQL Post", body: "Created via GraphQL mutation") {
3
id
4
title
5
body
6
user_id
7
}
8
}
Response JSON
1
{
2
"data": {
3
"createPost": {
4
"id": "local-f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
5
"title": "New Sandboxed GraphQL Post",
6
"body": "Created via GraphQL mutation",
7
"user_id": "1"
8
}
9
}
10
}
Update a post
Execute updatePost mutation to modify fields of an existing post row in your sandbox overlay.
Query / Mutation
1
mutation UpdatePost {
2
updatePost(id: "1", title: "Updated Post Title via GraphQL", body: "Modified body text") {
3
id
4
title
5
body
6
}
7
}
Response JSON
1
{
2
"data": {
3
"updatePost": {
4
"id": "1",
5
"title": "Updated Post Title via GraphQL",
6
"body": "Modified body text"
7
}
8
}
9
}
Delete a post
Execute deletePost mutation to remove a post from your session overlay view.
Query / Mutation
1
mutation DeletePost {
2
deletePost(id: "1")
3
}
Response JSON
1
{
2
"data": {
3
"deletePost": true
4
}
5
}
Pagination & Filtering
Limit and paginate posts query using page, limit, user_id, q search, and sorting arguments.
Paginated Query
1
query PaginatePosts {
2
posts(page: 1, limit: 2, user_id: "1", q: "Getting", _sort: "title", _order: "asc") {
3
id
4
title
5
user_id
6
}
7
}
Paginated Response
1
{
2
"data": {
3
"posts": [
4
{
5
"id": "1",
6
"title": "Getting Started with Playground API",
7
"user_id": "1"
8
}
9
]
10
}
11
}
Query Arguments
| Argument | Type | Description |
|---|---|---|
| page | Int | Page number for pagination (default: 1). |
| limit | Int | Number of items per page (default: 10, max: 30). |
| user_id | ID | Filter posts authored by user ID. |
| q | String | Full-text search query across title & body. |
| _sort | String | Field name to sort by (e.g. title, id). |
| _order | String | Sort direction ("asc" or "desc"). |
Schema Posts Type
| Field | Type | Description |
|---|---|---|
| id | ID! | Unique post identifier (Integer for global, local-uuid string for sandbox). |
| user_id | ID! | Author user ID foreign key. |
| title | String! | Headline title of the post. |
| body | String! | Main text body content. |
| user | User | Relational author User object. |
| comments | [Comment!]! | List of relational comments linked to this post. |