54: Does your API Spark Joy — Learn decluttering with GraphQL
Description
Calling APIs to retrieve data can be a difficult and messy process. Our two guests, Mark Stuart and Shruti Kapoor, are both engineers at PayPal who use GraphQL to bring order to their APIs and data.
What is GraphQL
GraphQL is a query language for your API, but as Shruti says, “A common myth people have about GraphQL is that we’re querying the database. But we’re not; we’re querying the API.” She adds, “GraphQL provides a way to call your API and get the data that you need.” Mark adds his own definition. “GraphQL is a query language that’s used to grab data and as a way to tell the backend system to change things, such as mutating operations. It also hides the mess of your APIs by putting almost a facade in front of it.”
GraphQL as an orchestration layer
Shruti says another way they use GraphQL at PayPal is as an orchestration layer. She explains this more in-depth: “Let's say you've got five different rest APIs, and now you want to combine them under GraphQL. So what you want is that your client should only see GraphQL APIs. But behind the scenes, you've got like this dirty table of all these REST APIs, which send you so much data, so you want to clean that up, right? So you put a nice tablecloth on it. That tablecloth is a GraphQL orchestration layer.”
How GraphQL combines with Apollo
The Apollo Graph Platform is one of the most popular tools to combine with GraphQL, with additional resources and documentation to help out. Shruti sums up Apollo’s uses for us: “They have Apollo Client for consuming GraphQL API on the client-side, and then they have Apollo server for building a GraphQL API on the server-side.” Apollo includes tools for consistent error handling, different hooks, as well as enterprise-level tools. Mark can attest to its usefulness. “At PayPal, we had a lot of duplication, a lot of graphs,” Mark says. “Apollo has some really cool tools to help merge all of that.”
Try Apollo and GraphQL to declutter your APIs.
Platform.sh
Learn more about us.
Get started with a free trial.
Have a question? Get in touch!
Platform.sh on social media
Twitter @platformsh
Twitter (France): @platformsh_fr
LinkedIn: Platform.sh
LinkedIn (France): Platform.sh
Facebook: Platform.sh
Watch, listen, subscribe to the Platform.sh Deploy Friday podcast:
YouTube
Apple Podcasts
Buzzsprout
Platform.sh is a robust, reliable hosting platform that gives development teams the tools to build and scale applications efficiently. Whether you run one or one thousand websites, you can focus on creating features and functionality with your favorite tech stack.