Join us for GraphQL Summit, October 10-12 in San Diego. Use promo code ODYSSEY for $400 off your pass.
Docs
Launch GraphOS Studio
You're viewing documentation for a previous version of this software. Switch to the latest stable version.

2. Add the GraphQL schema


This tutorial uses a modified version of the GraphQL server you build as part of the Apollo full-stack tutorial. You can visit https://apollo-fullstack-tutorial.herokuapp.com/ to start it up and open the GraphQL Playground tool to explore its .

The GraphQL Playground query explorer

The schema defines which GraphQL s your server can execute. Click Docs on the right-hand side to view a list of types you can query (and the types of s on those types) along with any possible s or subscriptions.

GraphQL Playground showing the schema

Download your server's schema

Apollo Android requires a to generate typesafe models and code from your queries. There are multiple ways to get a schema. For an example, you can download a json schema directly from GraphQL Playground by clicking Schema > Download in the right pane.

In this tutorial, we will use the apolloDownloadSchema task that is created by the plugin automatically. Since GraphQL supports introspection, this will work with any GraphQL endpoint that has enabled.

From the root of the project, run the following:

mkdir -p app/src/main/graphql/com/example/rocketreserver/
./gradlew :app:downloadApolloSchema --endpoint='https://apollo-fullstack-tutorial.herokuapp.com/' --schema='app/src/main/graphql/com/example/rocketreserver/schema.json'

This will download a schema.json file from your endpoint to app/src/main/graphql/com/example/rocketserver/schema.json.

Next, write your first query that uses this .

Previous
1. Configure your project
Next
3. Write your first query
Edit on GitHubEditForumsDiscord