Search This Blog

About Me

Chennai, TamilNadu, India
I am a craftsperson by passion and quality assurer by profession. I love to build - a craft or a piece of code. I look for reusability in crafts and usability in APPs. I always find something new to create and something new to learn. I believe in liberal world, flexible schedules and boundaryless place . https://automationautomated.blogspot.com/p/am-into-software-test-automation-and-r.html

Monday, August 2, 2021

GraphQL - Part 1


 GRAPHQL 

    Though GraphQL was in use for years, recently its gaining more popularity. One would say, am happy with REST why GraphQL? Well, do you remember the days of SOAP API and dealing with xml?
REST has been the de facto standard for APIs for a while now, replacing the relatively cumbersome and XML-only SOAP-based APIs with an architecture that is more flexible, lightweight and easier to develop. However, REST is not without limits of its own. With pure REST, if you need to gather and combine data from multiple endpoints or entities, the API consumer typically needs to invoke multiple endpoints, collect the data from each of these endpoints and combine and filter that data into something useful.

 Advancement is inevitable and the need for speed, scalability while dealing with huge data is the drive for GraphQL. GraphQL tries to solve this problem by exposing all data through a single endpoint and allow the API consumer to write queries that retrieve the exact data required at any given moment, all with a single API call.



History

Facebook invented GraphQL, and now it is maintained by a large community of companies and individuals all over the world. GraphQL is a specification and, users shall create their implementation on different platforms conforming to the specification.

Netflix Open-Sourced their implementation called Falcor.

An easy example for folks coming from Test Automation world, it is like WebDriver being a W3C Specification, Selenium and WebDriverIO are its browser automation implementation.


Why Facebook created GraphQL is an exciting story in itself and is available here as a documentary.

One of the problems that Facebook wanted to solve is the speed and user experience of facebook.com. After a few ideas, the team came up with two main mantras that would work. The team started working towards achieving them, namely As little as possible, as early as possible and Engineering experience in service of user experience. They achieved this by unifying the fetching of code and data in one single GraphQL query—the GraphQL’s ability to ally the request and minimises network usage is outstanding. 
More… here.

What is GraphQL?


GraphQL is an API specification standard and an Open-Source data query and manipulation language. 

GraphQL follows WYAIWYG pattern What You Ask Is What You Get. GraphQL allows declarative data fetching where a client can specify what data it needs from an API.

GraphQL is promising and evolving by the adoption of a large group of companies rolling out GraphQL in production. However, there is definitely, few caveats in this new modern API design too like caching, Authorization, Error handling, n+1 problems. And there are ways to navigate through these problem areas.

No comments:

Post a Comment

AutomationAutomated Blog