How to fetch schema

Can someone please provide a curl example of fetching the schema definition. From the docs I tried this:

curl -H “Content-Type: application/json” -X POST localhost:8080/admin -d
‘{
getGQLSchema {
schema
}
}’ | python -m json.tool

I got this error:

“Not a valid GraphQL request body: invalid character ‘g’ looking for beginning of object key string”

Thanks!

Try the content type application/graphql as opposed to application/json.

All I get is this with application/graphql:

"data": {
    "getGQLSchema": null
}

There’s definitely a schema there; I can see it in Ratel.

What you can see in Ratel is the DQL schema, and always you gonna see something there. You are querying for GraphQL Schema. If you didn’t created the GraphQL schema, it won’t show anything in the GraphQL request.

Ok. What’s the curl command, including the Content-Type header, to see the DQL schema? That’s what I can’t piece together from the documentation. Thanks.

Basically something like this:

curl -H "Content-Type: application/dql" localhost:8080/query -XPOST -d '{
  schema {}
}' | python -m json.tool | less

See more at https://dgraph.io/docs/query-language/schema/#querying-schema

That works great. Thank you!