Sixteen years ago, Roy Fielding introduced REST to the world. Originally used to drive the development of HTTP/1.1, it also became the architecture of choice for APIs, and companies like Flickr, Facebook, and Twitter were instrumental in pushing REST as they released APIs for sharing user content. In 2006, Amazon began releasing APIs that would fundamentally change the world of web development and usher in the age of cloud computing. In all this time, our usage of APIs has changed drastically. But the architecture of these APIs hasn’t changed much at all. What does the future of API development look like?
REST is a well-documented and widely adopted standard, but there are areas in which it falls short. Clients often must make many HTTP requests to receive the data they need to render a single view. REST APIs need to be versioned as breaking changes are introduced. Many omit hypermedia links, an important aspect of RESTful architecture. Also, REST is tied to HTTP as its transfer protocol and depends heavily on external addresses like URLs that are expected not to change. Finally, the behavior of REST APIs isn’t inherently discoverable. If a REST API isn’t well documented, it’s very frustrating to write clients to consume it.
Thankfully, a new alternative to RESTful APIs is emerging that can deal with all of these shortcomings and more. Enter GraphQL, a tool written by Facebook to help power its mobile applications. As you might guess from its name, GraphQL is a query language. It’s also perfect as an API layer in ways that REST can’t compete with. GraphQL is strongly typed and hierarchical and allows clients to request exactly the data they need. No more, no less. And because it isn’t tied to any specific storage layer, it works with your existing code and data.
David Celis and Garen Torikian demonstrate how you can use GraphQL to build your APIs and explain why companies like Shopify, Pinterest, and GitHub are choosing GraphQL.
David Celis is a software engineer at GitHub (where he writes APIs) in Portland, OR (where he drinks IPAs). As a platform engineer, he works with GitHub’s API, third-party integrations, webhooks, and, most recently, its early-access GraphQL API. David is on the internet in most places as @davidcelis.
Garen Torikian wants to help make the world a better place for humans and other sentient beings on earth. Garen’s been programming ever since he learned how to make GIFs for his GeoCities website in the late ’90s. He writes, writes documentation, and writes tooling to help people who write documentation. He was a reader of books long before he was a writer of code. You can find him almost anywhere on the internet by the handle @gjtorikian.
Help us make this conference the best it can be for you. Have questions you'd like this speaker to address? Suggestions for issues that deserve extra attention? Feedback that you'd like to share with the speaker and other attendees?
Join the conversation here (requires login)
©2017, O'Reilly Media, Inc. • (800) 889-8969 or (707) 827-7019 • Monday-Friday 7:30am-5pm PT • All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. • firstname.lastname@example.org