GraphQL vs Rest

I recently worked on a small project that involved consuming GitHub’s GraphQL API to display specific users’ public repositories. This project was a great opportunity for me to learn about GraphQL and how it differs from REST API. In this reflection blog, I will share my experience of using GraphQL API and the challenges I faced during the project.

One of the biggest challenges I faced while learning to use GitHub’s GraphQL explorer was understanding how the data was structured. It was a little overwhelming at first, but I overcame this challenge by watching a few YouTube videos and reading through other developers’ GitHub repositories. Once I got the hang of it, I found GraphQL to be quite powerful.

For those who may not be familiar, REST is a popular architectural style used in designing and developing web services. It involves the use of HTTP protocol for communication and works on the principle of stateless communication. The resources are accessed using HTTP methods such as GET, POST, PUT, DELETE, etc., and the response from the server is usually sent in JSON, XML, or HTML format.

On the other hand, GraphQL is a query language created by Facebook that allows clients to request only the required data. Unlike REST, which returns all the data present in the resource, GraphQL has a strongly-typed schema that defines the data structure of the API. Clients can request data by specifying the required fields in the query.

The main differences between GraphQL and REST APIs are:

In conclusion, both GraphQL and REST have their own advantages and disadvantages, and the choice between the two depends on the specific requirements of the project. My experience of using GitHub’s GraphQL API was quite positive, and it was interesting to see the data available from GitHub. Overall, this project helped me broaden my knowledge and experience of working with different APIs, which will certainly come in handy in my future development projects.

Link to GitHub repo