An example of implementing a simple GraphQL client in Go to query against a public GraphQL service https://countries.trevorblades.com/. The client makes 2 calls:
GraphQL request without any filter.
GraphQL request with a filter passed as a parameter.
We can construct a GraphQL query as a string and pass it as plain text when making the API call. But for the construction of more complex queries, including support for passed arguments, we may want to use a GraphQL package, like the machinebox/graphql package.
Setup
Run the program
$ make
Querying from the Playground
GraphQL is a querying language that can be embedded in a programming language like Go and a transport stack like HTTP. The following steps show how the same GraphQL queries can be made from the service GraphQL playground.