Are you struggling with GraphQL?

Many people are just starting with GraphQL and finding the approach new and completely different to what they have experienced before.

I’ve found this guide very useful:

especially for inline fragments, e.g.:

query HeroForEpisode($ep: Episode!) {
  hero(episode: $ep) {
    name
    ... on Droid {
      primaryFunction
    }
    ... on Human {
      height
    }
  }
}

or for passing variables:

query HeroNameAndFriends($episode: Episode) {
  hero(episode: $episode) {
    name
    friends {
      name
    }
  }
}

You can test GraphQL queries in our GraphiQL explorer using your read-only API token.

And remember that hitting Ctrl+Space od Cmd+Space you get a nice auto-suggestion:

image

and also you can explore the schema using the documentation:

1 Like