Zencargo and GraphQL

GraphQL is Zencargo's technology of choice for building APIs. If you're used to working with REST APIs, then GraphQL might seem confusing at first. When you begin using GraphQL, you need to change how you think about retrieving and working with data. The following guides are designed to introduce you to GraphQL concepts and to help you begin experimenting with GraphQL.

What is GraphQL?

GraphQL is a query language and a runtime for fulfilling those queries. Clients form requests (Queries & Mutations) by using the GraphQL query language, and the GraphQL server executes the request and returns the data in a response. Unlike REST APIs, which expose a different endpoint for each resource object, a GraphQL API makes all data available at a single endpoint. GraphQL gives clients the power to ask for exactly what they need and nothing more.

GraphQL & its benefits

Before you start playing with GraphQL and sending requests, let's examine some of the benefits of using GraphQL

GraphQL REST
Only get exactly what you need from the server, and receive that data in a predictable way No control over received data, always getting whole payload
Ability to retrieve many resources in a single request Fetching associated data often requires multiple HTTP calls
Everything is typed and part of a schema which allows API consumers to know exactly what data is available, and in what form it exists Usually weakly-typed and lack machine-readable metadata
Documentation & Deprecation are first class citizens Needs versioning & Explicit documentation of endpoints and payloads

Your first steps with GraphQL

Other GraphQL resources

If you want to look deeper into GraphQL here are some guides & starting points to do so:

Guides

Libraries

Next Steps