Slash graphql — Dgraph Doc v20.07

Your GraphQL schema can be fetched and updated using the /admin endpoint of your cluster. As an example, if your graphql endpoint is https://frozen-mango-42.us-west-2.aws.cloud.dgraph.io/graphql, then the admin endpoint for schema will be at https://frozen-mango.us-west-2.aws.cloud.dgraph.io/admin.

This endpoint works in a similar way to the /admin endpoint of Dgraph, with the additional constraint of requiring authentication.

Fetching the Current Schema

It is possible to fetch your current schema using the getGQLSchema query on /admin. Below is a sample GraphQL query which will fetch this schema.

{
  getGQLSchema {
    schema
  }
}

Setting a New Schema

You can save a new schema using the updateGQLSchema mutation on /admin. Below is an example GraphQL body, with a variable called sch which must be passed in as a variable

mutation($sch: String!) {
  updateGQLSchema(input: { set: { schema: $sch}})
  {
    gqlSchema {
      schema
      generatedSchema
    }
  }
}

This is a companion discussion topic for the original entry at https://dgraph.io/docs/slash-graphql/admin/schema/

Testing out comments

The /admin/schema endpoint does not work for me on Slash GraphQL. I’m getting 404 - Not found.
It works for me locally using dgraph/standalone:latest. Is this intentional?

Any response?

You can now click on Ratel to perform your admin stuff in Slash now I believe. Not sure about the endpoints still