November 24, 2019

434 words 3 mins read

From REST to GraphQL: Why a query language is perfect for writing APIs

From REST to GraphQL: Why a query language is perfect for writing APIs

For years, REST has been the standard architecture for APIs. But a new technology is emerging, one that's perfect for developing rich, client-friendly APIs: GraphQL. David Celis and Garen Torikian explain why this query language is being adopted by companies like Shopify, Pinterest, and GitHub and show you how you can leverage GraphQL for your own APIs.

Talk Title From REST to GraphQL: Why a query language is perfect for writing APIs
Speakers David Celis (GitHub), Garen Torikian (GitHub)
Conference O’Reilly Open Source Convention
Conf Tag Making Open Work
Location Austin, Texas
Date May 8-11, 2017
URL Talk Page
Slides Talk Slides
Video

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. Topics include:

comments powered by Disqus