The challenge of many APIs
APIs power the apps we use, and the services we rely on every day. From planning trips to ordering groceries online, APIs are the magic behind the scenes that make it all happen.
But let's be honest: orchestrating all those API calls can get pretty challenging, especially as your architecture grows.
Chances are, your apps have hundreds of lines of code to handle API orchestration: you might need to sequence API calls from a bunch of different sources, or wait on one response before having to pipe a piece over to another request or have to navigate through and transform complex, nested data structures. Keeping that code organized and maintainable as your system scales can quickly become messy.
Or, if you're already using GraphQL Federation, you're dealing with building subgraph servers. That means picking a framework, learning how to use it, and writing resolver functions to connect to your data sources. It takes a bit of time, and it can feel overwhelming.
Either way, organizing and managing API calls efficiently is a constant challenge in app development. But it doesn't have to be!
Introducing Apollo Connectors
Apollo Connectors transform the way we connect to REST APIs, simplifying API orchestration in a declarative, configuration-first approach.
We do all of our work inside a GraphQL schema: a collection of types and fields that build the comprehensive picture of everything we can do with our API. With Apollo Connectors, we define requests to our data sources and map the responses to our schema. We get to pick the exact fields we need and shape the data just the way we want it. No more complex data-fetching code; just clean, declarative queries that anyone on our team can understand.
And if you're already using federation, connectors build on top of what you already know. Whenever you need to bring a REST API into your graph, you can skip those time-intensive steps of building a subgraph server.
In this course, we'll cover the basics of Apollo Connectors, including how to set up our schema and the directives that make it all work. We'll also explore tools like the Rover CLI to run our API and Apollo Sandbox to send and debug our connector calls.
Learner pre-requisites
We assume that you're familiar with the basics of a GraphQL schema and how to send GraphQL operations. Check out graphql.com/learn if you need a refresher. You don't need to know any particular programming language for this course.
Practice
Key takeaways
- Apollo Connectors provide a declarative, configuration-first approach for simplifying API orchestration.
- With Apollo Connectors, we define requests to our data sources and map the responses to our schema.
Up next
Ready? Let's set up the project we'll be working with, a space travel booking API, so we can get hands-on with Apollo Connectors!
Share your questions and comments about this lesson
Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.
You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.