Lab: Connect your own API (⏳ 20 min)
Now it's time to put your Connector skills to the test! In this hands-on lab, use a REST API of your choice to extend your existing project or create a new one. This is your opportunity to work with real-world data and demonstrate your understanding of Apollo Connectors.
🎯 Lab Goals
By the end of this lab, you should have:
- Connected a REST API to your GraphQL schema.
- Defined at least one new type with multiple fields from your API
- Successfully queried your data through GraphQL
📋 Requirements
Choose one of the following approaches:
Option A: Extend your current project
Add a new Connector to your existing workshop project that integrates with a different REST API.
Option B: Create a new project
Start fresh with rover init and build a Connector from scratch.
🛠 Suggested APIs to use
If you don't have your own API in mind, here are some free, open APIs you can use:
- REST Countries - Complex nested objects, multiple field mappings. Try retrieving a list of countries including their capital and currency.
- Pokemon API - Large objects, selective field mapping. Try retrieving a list of Pokemon including their abilities and stats.
- JSONPlaceholder - Simple data structures, relationships between types. Try retrieving a list of users including their albums and each album's photos.
You can also check out our Connectors Library for pre-built Connectors to integrate into your project. If you choose to use a pre-built Connector, you must use at least two.
💭 Resources
🔍 Check your work
What's next?
Thanks for trying out Connectors! What's next?
Publish your schema to GraphOS and take advantage of observability with Connectors.
Want to share this training with your teammates? Share the Odyssey course instead! We've got step-by-step instructions, screenshots, quizzes and explanations that don't need an in-person instructor.
We'd love to hear your feedback about Apollo Connectors, so reach out to us in our community forums.