Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

REST API vs GraphQL - when to use which?

Last updated on 3 days ago
K
KevinSenior Member
Posted 3 days ago
User: APIdev_Questions
Subject: REST API vs GraphQL - when to use which?
I am designing APIs for new web application. Should I use traditional REST API or go with GraphQL? I see lot of hype around GraphQL but not sure if its really better than REST or just trend. What are pros and cons of each?
K
KevinSenior Member
Posted 3 days ago
Reply by: BackendArchitect_Senior
REST is mature, well understood, and works perfectly fine for most applications. Use REST when your data model is simple and you have standard CRUD operations. GraphQL is better when you have complex data relationships and want to give clients flexibility to request exactly what they need. But GraphQL has learning curve and adds complexity. Dont use GraphQL just because its trendy.
K
KevinSenior Member
Posted 3 days ago
Reply by: MobileApp_Developer
From mobile developer perspective, GraphQL is great because I can fetch all needed data in single request instead of making multiple REST API calls. This reduces network overhead and makes app faster. But on backend side, GraphQL queries can be expensive if not optimized properly. You need to implement things like query depth limiting, complexity analysis etc to prevent abuse.
K
KevinSenior Member
Posted 3 days ago
Reply by: StartupCTO_Experience
My advice is start with REST. Its simpler to implement and debug. Once your application grows and you face issues like over-fetching or under-fetching data, then consider migrating to GraphQL. We started with REST and added GraphQL later only for specific use cases. Now we have hybrid approach - REST for simple endpoints and GraphQL for complex data fetching.
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.
Sign In
Not a member yet? Click here to register.
Forgot Password?
Users Online Now
Guests Online 5
Members Online 0

Total Members: 19
Newest Member: bokovac