If you’ve read an article or even some brief description of GraphQL, it probably included a line about what it does better than REST and other APIs. Glancing over the question like that isn’t really fair though is it? You won’t get the whole picture without really looking at each API’s uses and advantages so let’s try to dig a bit into that here.

GraphQL — the new standard

Image for post

GraphQL is a flexible system for requesting data that focuses on pinpoint requests and delivering exactly what is required. What sets GraphQL apart from other APIs is its unique approach, it’s client-driven. Instead of handling it as usual (i.e. server to a client), where the client decides how everything is handled. The main benefits are:

  • Adaptability — the client decides what data they want, how they want it and what format they want to get it in,
  • Efficiency — delivers exactly what the client requests without over fetching,
  • Flexibility — GraphQl is cross-platform and supports more than a dozen languages (Perl, Java, Python, PHP among others).

The most well-known example of GraphQL application is probably GitHub. They switched to it in 2016 citing scalability and flexibility as the two major reasons. REST simply wasn’t cutting it for them, because it often required multiple requests to get the data you wanted and also over-fetched data on each of those requests. With GitHub’s rapid growth and user base in the tens of millions, you can imagine how big a concern that had to be. GraphQL provided exactly the alternative they needed because it’s focused on the client being able to request particular data in a specific format for a specific use.

#graphql #rest #devops #grpc

GraphQL vs REST vs gRPC - Choosing the right protocol for the job
13.70 GEEK