Choose your Approach

Choose how and what data sources and APIs to connect to your graph


Apollo GraphOS supports the orchestration of both REST APIs and GraphQL APIs as data sources for your graph. You can use both together in the same graph.

To connect REST APIs to your graph, you'll use Apollo Connectors.

To connect GraphQL APIs to your graph, you'll use a federation-compatible subgraph in the programming language of your choice.

Identify your data sources

First, identify the data sources you need for your use case. These can be REST APIs, a database, or a third-party API. Gather a list of what you'll need to implement your use case.

Review requirements and limitations

If your data source is a REST API, review the following articles:

If your data source isn't a REST API, you'll need to use a GraphQL API that is federation-compatible.

Comparing approaches: Connectors vs subgraphs
Using REST APIs with Apollo Connectors
Benefits:
  • Connect existing APIs with no additional infrastructure
  • Use declarative GraphQL to select, filter, and map fields from existing schemas to the new supergraph
  • Supports any HTTP JSON API and many basic features like header forwarding and authorization
Considerations:
Using GraphQL APIs with subgraphs

Benefits:
  • Fine-grained control for field-level resolvers
  • Development in any programming language of your choice
  • Separate layer to handle performance optimizations
Considerations:
  • Added latency for another hop in the service stack
  • Infrastructure management required to deploy GraphQL servers
  • Maintenance of another microservice

Make a decision

Using the information in the previous step, decide if Connectors are a good fit for your use case.

If you decide to use Connectors, proceed to the guide for connecting REST APIs.

If you can't use Connectors, or Connectors aren't a good fit for your use case, proceed to the guide for connecting GraphQL APIs.

Feedback

Edit in VSCode

Ask Community