4 ms·
The one thing I never got with GraphQL is what do you query if you don't know what to query for??? Can someone answer this for me. I don't know what I need. Se
by mattmurdog 9y ago
The one thing I never got with GraphQL is what do you query if you don't know what to query for??? Can someone answer this for me.
I don't know what I need. Server tells me I need {allthedogs}. Now I know to query for {allthedogs}... what's the point of GraphQL?
- epidemian 9y agoUsually GraphQL APIs are served alongside a GraphiQL client, which lets you run queries, and read the schema and docs for that API. See, for example, the Star Wars API example: http://graphql.org/swapi-graphql/ http://graphql.org/swapi-graphql/
- exogen 9y agoThe schema should still be documented somewhere, like any API. But even if it's not: GraphQL supports a special "introspection query" that will tell you the entire schema that you can query. Pointing a tool like GraphiQL (https://github.com/graphql/graphiql https://github.com/graphql/graphiql) at a GraphQL endpoint will even run the introspection query automatically and turn the result into rendered explorable documentation. That's how you figure out what to query.