Consuming GraphQL APIs
Building GraphQL APIs
Learn how to build GraphQL APIs using StepZen for all your data sources using GraphQL Schema Definition Language (SDL). StepZen supports the root operation types: Query, Mutation, and Subscription.
There are two ways to create your GraphQL API in StepZen:
- Specify the data source you want to GraphQL-ize on the command line
(stepzen import ...)and let StepZen generate the schema for you, or
- Write your schema using GraphQL directives
@graphql)- powerful declarative constructs that provide a simpler, more efficient way to build GraphQL.
The code you generate using a
stepzen importcommand writes the schema including the
@graphqldirectives for you. Whether you build a graph or federate graphs, StepZen's declarative approach lets you create concise APIs with built-in performance, cost, and reliability optimizations.
|How to . . .
|Convert Each Backend into a Graph. There are two ways to create your GraphQL API - specify the backend and let StepZen generate the GraphQL for you, or write your schema using declarative constructs. Either way, you can have your GraphQL endpoint created and deployed in minutes.
|1. Generate your Schema using
stepzen import CLI. The quickest way to get started. Using the
stepzen import CLI, you specify an existing backend data source - StepZen introspects the endpoint and auto-generates a GraphQL schema for you.
|2. Write Schema Code using Declarative Constructs. Write your schema code in a GraphQL Schema Definition Language (SDL)file. Use one of the GraphQL directives, @rest, @dbquery, and @graphql to connect and configure backends; link types using @materializer. You can design a schema with interfaces to enable access to multiple backends. With a few lines of declarative code, you have a working schema.
|Write GraphQL Schemas
|Secure your Schema and Endpoint. Use Admin Keys, API Keys, JWTs, and Field Policies to secure access to your schemas, endpoints, and backends.
|Secure Schemas & Endpoints
|GraphQL Federation: Combine subgraphs into a supergraph. Build subgraphs in StepZen, or some other library or tool, and federate them in StepZen. You can build subgraphs in StepZen, or proxy subgraphs not built in StepZen, and then easily enable them for Apollo Federation.
|Troubleshooting & Testing Learn to troubleshoot, test, and measure the performace of your GraphQL API.
|Troubleshooting and Testing
|CLI Reference. The StepZen CLI is the primary tool for creating, uploading, deploying and testing your StepZen API. It is available via npm:
npm install -g stepzen
|StepZen CLI Reference
|GraphQL Directives Reference. A schema defines your GraphQL APIs and incorporates annotations called directives to control how your schema is executed. GraphQL directives @rest, @dbquery, @graphql, @materializer, @sequence, etc. allow you to code your data connections, sequence queries, stitch schemas, and more - declaratively in StepZen.
|GraphQL Directives Reference
|Features Reference. Learn how to encode Form Data into a request or on an HTTP POST method. Explore built-in GraphQL Scalar Types, and custom StepZen Scalar Types. Learn how to use mock data to test your queries and schemas and how to create sequences of queries.