Skip to main content

GraphQL Request

You can access to all the graphql queries and mutation by using our Javascript Client.

Query

To perform a query, we need to use query method as followed:

client.query({
name: 'post', // Name of the query in graphql
args: {
variables: { // Variables that we pass to the query
id: '{postId}'
},
fields: { // Fields to be returned
owner: {
member: 'basic',
},
},
},
})

Mutation

To perform a mutation, we need to use mutation method as followed:

client.query({
name: 'updateMember', // Name of the mutation in graphql
args: {
variables: { // Variables that we pass to the mutation
id: '{memberId}',
input: {
name: 'New Name',
},
},
fields: { // Fields to be returned
role: 'basic',
},
},
})

Fields

When making a query or mutation request, our client will, by default, return the basic fields of the output. However, you have the flexibility to expand the result by specifying which nested fields you wish to retrieve. For instance, in the updateMember mutation, there may be several nested objects, such as fields and role. To obtain a more comprehensive result, you can set these objects to "basic" as illustrated below:

client.query({
name: 'updateMember',
args: {
variables: {
id: '{memberId}',
input: {
name: 'New Name',
},
},
fields: { // Fields to be returned
role: 'basic',
fields: 'basic',
spaces: 'basic'
},
},
})
info

To know more about our GraphQL schema, you can read the GraphQL reference section here.