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
graphql
1
query GetAllPosts {
2
posts {
3
id
4
title
5
body
6
user_id
7
}
8
}
Response JSON
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
graphql
1
query GetSinglePost {
2
post(id: "1") {
3
id
4
title
5
body
6
user_id
7
}
8
}
Response JSON
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
graphql
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
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
graphql
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
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
graphql
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
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
graphql
1
mutation DeletePost {
2
deletePost(id: "1")
3
}
Response JSON
json
1
{
2
"data": {
3
"deletePost": true
4
}
5
}

Schema Posts Type

FieldTypeDescription
idID!Unique post identifier (Integer for global, local-uuid string for sandbox).
user_idID!Author user ID foreign key.
titleString!Headline title of the post.
bodyString!Main text body content.
userUserRelational author User object.
comments[Comment!]!List of relational comments linked to this post.