Why we choose GraphQL?
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data the API, and gives clients the power to ask for exactly what they need and nothing more, this makes it easier to evolve APIs over time, and enables powerful integration to be developer much faster than they would be in REST APIs.
The GraphQL data query language has the following properties, which make it an excellent choice:
- It's a specification The spec determines the validity of the schema on the API server. The schema determines the validity of client calls.
- It's strongly typed The schema defines an API's type system and all object relationships.
- It's introspective A client can query a GraphQL schema for details about itself.
- It's hierarchical The shape of a GraphQL call mirrors the shape of the JSON data it returns. Nested fields let you query for and receive only the data you specify in a single round trip.
Querying with GraphQL
GraphQL queries are hierarchical and composed, describing a tree of information. The query is shaped just like the data it returns. It's a natural way to represent nested data, and it fits nicely with modern component-based UI frameworks.
There are many library's available for querying GraphQL, internally we use Apollo Client for React, and we recommend if you are using Node you do the same. However, if you use using another language or framework, there are many other options available see here .
Trying queries or mutations outside of your application
If you want to try out queries or mutations without writing any code inside you application, you can do this using a third party tool for testing APIs.
There are many options for this, but popular choices are: