Should I use GraphQL?

herVi853 report abuse

I want to create an API. Should I use the GraphQL, or it is just a hype, and the old familiar RESTful API will be better?

Answers

erikpal report abuse

It depends on the way how you assume your API will be used. Can you tell a little bit more about your API?

herVi853 report abuse

This is just an API for fetching data from different internal resources. I am also developing the web and mobile application, and they will need to use this API for their activity.

Zuska report abuse

How many endpoints are you going to create in your API?

herVi853 report abuse

Actually, I am not sure yet, but probably from 5 to 10.

Zuska report abuse

If you are going to use the API by both mobile and web application, I think that it is a good reason to create it using GraphQL. Also, you can simplify the structure of the API: instead of having many endpoints, with GraphQL, you will have just one single endpoint.

erikpal report abuse

Yes, @Zuska is right. Facebook, where the GraphQL was developed, created the GraphQL precisely for API standardization. They didn't want an API to have many endpoints, and also, they needed to use API both with mobile and web applications. If they would develop RESTful API, they had to create different endpoints for mobile and web, because different data often should be fetched (mobile apps are typically interested in smaller amounts of data due to slow and limited Internet connection).

herVi853 report abuse

Thanks! I understood the use cases where GraphQL is advisable. Now I need to think whether I actually want to use it.

Add Answer

Need support?

Just drop us an email to ... Show more