GraphcoolDocs
FAQ

API

Last updated a day ago Edit this page

Frequently asked questions about the API that's provided by Graphcool.

#What is the difference between the Simple API and the Relay API?

Every Graphcool service comes with two different GraphQL APIs. Note that both APIs still access the same underlying database!

  • The Simple API exposes simple and intuitive CRUD operations and supports realtime functionality based on GraphQL subscriptions. This should be the default for any consumer of the API that's not using Facebook's homegrown GraphQL client Relay.
  • The Relay API also exposes CRUD operations while adhering to the specific requirements of Relay.

#How does error handling work with Graphcool?

Graphcool conforms to the GraphQL specification for error handling.

If a requested fails, the JSON payload of the server's response will contain a root field called errors that contains precise information about the problems that occured on the server-side.

Since GraphQL allows for multiple operations to be sent in the same request, it's well possible that a request only partially fails and returns actual data and errors.

Notice that HTTP status codes are not relevant when using GraphQL! A GraphQL server will always respond with code 200 (unless an internal server occured, then it might be code 500). Any further information needs to be parsed from the JSON payload of the response.

#Does Graphcool support realtime functionality?

Yes. Graphcool offers a realtime API based on GraphQL subscriptions. It allows you to subscribe to specific events that are happening in the backend, for example when database records are created, updated or deleted.

GraphQL subscriptions are extremely powerful. They not only allow to react to events, subscribers can also specify exactly the data they want to receive when the event occurs. This is done using regular GraphQL queries.

#Does Graphcool support offline apps?

Graphcool is a backend development framework. As such, it's only concerned with the implementation of the web server and its API. Offline support is a question relating to the client-side, consequently Graphcool itself doesn't have any support for offline usage.

However, the communities around popular GraphQL clients like Apollo and Relay are already debating ways to solve this.

Related discussions:

#Can I integrate 3rd-party APIs, my existing microservices or any other systems with my Graphcool API?

This is absolutely possible and there are essentially two ways of achieving it:

In any case, the result will be that the external functionality you want to integrate will become part of your GraphQL API.

This is an extremely powerful feature that allows to hide the complexity of interacting with many independent systems behind a single, coherent GraphQL API!

#Can I change the auto-generated GraphQL schema that defines my API?

You can not change the auto-generated CRUD API that's generated by the GraphQL engine.

However, using Graphcool's API proxy layer, you can define your own GraphQL API and easily map it to the operations in the auto-generated CRUD API. You can also write your own Resolver functions to extend the capabilities of your API or "wrap" certain operations from the CRUD API.

#Some GraphQL tooling I'm using requires the full GraphQL schema. How can I get access to it?

The easiest way to download your GraphQL schema is by using the graphql-cli:

graphql get-graphql-schema

Was this page helpful?

Recommended