Reputation: 1160
I am learning GraphiQl now and try to list all available queries that I can make. I run this:
{
__schema {
types {
name
}
}
}
and eventually get some schema types, but not all of them. If I look up docs that are on the right side ("Documentation explorer") I can see root types query: Query
that lists more queries like user
and users
(these were not shown on my introspection queries). There are few screenshots:
]3
Question: how could I view these lowerCase methods like allUsers
from query? For example, I won't have access to docs and will have only introspection query.
Thanks!
Upvotes: 4
Views: 1267
Reputation: 15173
With the query that you're using as shown, it would only give you the Types of objects. You can get all the queries of Query
type with the below:
{
__schema {
queryType {
name
fields {
name
}
}
}
}
For example, running the above on GitHub's GraphQL responds with the below:
{
"data": {
"__schema": {
"queryType": {
"name": "Query",
"fields": [
{
"name": "codeOfConduct"
},
{
"name": "codesOfConduct"
},
{
"name": "enterprise"
},
{
"name": "enterpriseAdministratorInvitation"
},
{
"name": "enterpriseAdministratorInvitationByToken"
},
{
"name": "license"
},
{
"name": "licenses"
},
{
"name": "marketplaceCategories"
},
{
"name": "marketplaceCategory"
},
{
"name": "marketplaceListing"
},
{
"name": "marketplaceListings"
},
{
"name": "meta"
},
{
"name": "node"
},
{
"name": "nodes"
},
{
"name": "organization"
},
{
"name": "rateLimit"
},
{
"name": "relay"
},
{
"name": "repository"
},
{
"name": "repositoryOwner"
},
{
"name": "resource"
},
{
"name": "search"
},
{
"name": "securityAdvisories"
},
{
"name": "securityAdvisory"
},
{
"name": "securityVulnerabilities"
},
{
"name": "topic"
},
{
"name": "user"
},
{
"name": "viewer"
}
]
}
}
}
}
You can search for the remaining fields within fields
that you might need to add to your query by searching for __Field
in the Documentation Explorer of GraphiQL.
Upvotes: 5