GraphQL: A success story for PayPal Checkout
PayPal Checkoutサービスは、四年間をかけて、純正REST APIから、 Batch APIへ移行して、さらに去年からPayPal Checkoutに全面移行したお話です。
However, REST's principles don't consider the needs of Web and Mobile apps and their users. This is especially true in an optimized transaction like Checkout. Users want to complete their checkout as fast as possible. If your applications are consuming atomic REST APIs, you're often making many round trips from the client to the server to fetch data.
When we took a closer look, we found that UI developers were spending less than 1/3 of their time actually building UI. The rest of that time spent was figuring out where and how to fetch data, filtering/mapping over that data and orchestrating many API calls. Sprinkle in some build/deploy overhead. Now, building UI is a nice-to-have or an afterthought.
GraphQL solves this and more. Performance -- You only get the data you asked for. No more, no less. Single round trip. You can query as part of a mutation too!
Flexibility -- Clients determine the size and shape of data, not servers.
Developer productivity -- Immediately productive, without tribal knowledge. If you know JSON, you know GraphQL. Incredible tooling, too!
Evolution -- With GraphQL, API developers know exactly what fields their clients are using and are able to make better choices when deprecating or evolving their APIs. With REST, this isn't possible so you extend and never delete.