REST vs RPC vs GraphQL API - How do I pick the right API paradigm?

  Рет қаралды 145,133

Ambient Coder

Ambient Coder

Күн бұрын

Пікірлер: 95
@saketmodi6280
@saketmodi6280 3 жыл бұрын
rest api : good for exposing crud operations rpc : good for exposing several actions Graphql: Good when need data filtering on client side.(Flexibility)
@dennycrane2938
@dennycrane2938 2 жыл бұрын
"with rest and rpc the api often returns fields that the client doesn't use" -- this is true, however, modern rpc frameworks like grpc do have things like FieldMask which solves this problem.
@wololo1657
@wololo1657 2 жыл бұрын
Thank you for creating this video. I was a bit confused about the use case for both RPC and GraphQL but now I understand the tradeoffs well enough to know when it's worth using one over the other. One thing I would've liked though, which maybe useful for future videos, is to have an example use case for each, that goes into detail for a simple application, which would illustrate tradeoffs potentially better.
@ambientcoder5462
@ambientcoder5462 2 жыл бұрын
That's some really useful feedback, I will keep that in mind for future videos! Thanks for the support!
@swainscheps
@swainscheps 2 жыл бұрын
really appreciate this. As others have noted...too many go straight to the bits and bytes and skip the practical considerations. Great video. Two thumbs up.
@maxxiao5651
@maxxiao5651 3 жыл бұрын
Best IT explanation video watched ever! Clear and Precise! Love it!
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Wow, thanks for the kind words!
@TomassoMd
@TomassoMd Жыл бұрын
Important aspect of RPC that was not mentioned: in general RPC leads to coupling of client and server, that is, implementation of server actions is reflection of what client (or particular implementation of client) needs. This limits flexibility and reusability. It is great for creating APIs that are going to be used closely with a particular product, but that limits potential future exposition of the API to other usages, like launching a public API for the product. Since the server API was designed around product needs (usually more high level actions and lacking granularity), moving to a different use case or opening up the API might be difficult to untangle.
@ankk98
@ankk98 3 жыл бұрын
Thank you for this series. Learnt a lot of important stuff that is not so easily available. Suggestion: please add some examples of each case, maybe you can use a tool like postman
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
I’m glad you found the series useful! Thanks for the suggestion, I’ll keep that in mind for future videos 👌
@sultanmuhammad595
@sultanmuhammad595 2 жыл бұрын
Thanks for such a good series. Its quite hard to find such series. Mostly are based on coding only and dont cover the theoretical part.
@ambientcoder5462
@ambientcoder5462 2 жыл бұрын
Glad you like them and thanks for the positive feedback!
@chiranjiveesaksham5173
@chiranjiveesaksham5173 3 жыл бұрын
Thanks for explaining in simple and easy way.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Happy to help 🙂
@thatgenzdev
@thatgenzdev 3 жыл бұрын
Best explanation I've seen so far.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thanks for your kind words 🙂
@Fullflexno
@Fullflexno 15 күн бұрын
Thank you for this. Cheers from norway!
@aworden
@aworden 3 жыл бұрын
Great explanation Thanks! And thanks for mentioning RPC APIs. They are the right solution 99% of the time in my experience.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thanks for your support! And yes you’re absolutely right - RPC is a good fit in most cases.
@r0ck566
@r0ck566 3 жыл бұрын
But why the majority of companies are still using REST?
@blitzpark1250
@blitzpark1250 3 жыл бұрын
@@r0ck566 I think it is 'cause rpc is built using http2 and many client+server architecture is on http/1.1
@nikthough3110
@nikthough3110 3 жыл бұрын
The way you explain is just simply golden. Subscribed and Liked.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thanks for the kind words 🙂
@Gorlung
@Gorlung Жыл бұрын
Why is for search in your REST example the PUT method being used and not the GET method?
@jeffreycui9933
@jeffreycui9933 Жыл бұрын
Thank you for the excellent video. But why use PUT for a search instead of using GET?
@dgillies5420
@dgillies5420 Жыл бұрын
6:05 I think mean, "You don't want to use _verbs_ ..." not "nouns"
@wishniks
@wishniks 2 жыл бұрын
Nice session that provides overview of the various types of API. Separate videos detailing each of the types along with examples would be really helpful!
@PradipLamsal-s8m
@PradipLamsal-s8m 6 ай бұрын
Thank you very much. Saved me a lot of hassle.
@112_akmalmahardikanp8
@112_akmalmahardikanp8 5 ай бұрын
really appreciate this. this fit what i am searching for
@MsTheBiggest
@MsTheBiggest 2 ай бұрын
Amazing overview
@josevalentinmoralesrobles9429
@josevalentinmoralesrobles9429 2 жыл бұрын
Great video, easy to understand and with a lot of useful information.
@mahdizarepoor8964
@mahdizarepoor8964 2 жыл бұрын
That was a neat video about them . I really enjoyed you explanation . Thanks
@sazidahmed3012
@sazidahmed3012 3 жыл бұрын
Nice Presentation with well explanation.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thank you, I’m glad you enjoyed it :)
@sazidahmed3012
@sazidahmed3012 3 жыл бұрын
@@ambientcoder5462 You can also create a video on FAST api
@nuny-vega
@nuny-vega 4 ай бұрын
Great video, thanks!
@soniablanche5672
@soniablanche5672 Жыл бұрын
There's nothing stopping you from customizing the REST Api to get smaller payloads by using query params to tell the server what fields you want. /api/user/1?q=name,age for example would return name and age only.
@MichelJung
@MichelJung Жыл бұрын
Yahoo's Elide implements this very well
@eugenpaval
@eugenpaval Жыл бұрын
Hmm, true, now imagine a client dealing with all these proprietary conventions. Add filtering and sorting to the mix. Also, how would one discover all these conventions? Documentation you say? And then deal with the results which will be expressed how the developer of a particular API method felt the day he implemented it. There is no consistency, no generic way to discover capabilities, hence no tools to help out. Some APIs went the way of OpenAPI specification to bring some sanity into the process. GraphQL is that plus more because it brings to the fore the familiar concept of a schema composed of types.
@ShawnThuris
@ShawnThuris 3 жыл бұрын
Clear and useful comparison.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thanks Shawn 🙂
@__init__k917
@__init__k917 3 жыл бұрын
Brooo you are awesome 🤘🤘🤘, I am grateful to discover this channel
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thanks bro! 🤘🤘 Hope you enjoy the content 🙂
@audreydelgado2198
@audreydelgado2198 3 жыл бұрын
Great information & explanation. Thank you .
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Glad it was helpful!
@aarontheeranitpongtongmuan233
@aarontheeranitpongtongmuan233 3 жыл бұрын
Great explanation. Thank you so much.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Glad you liked it!
@LarryPeteet
@LarryPeteet Жыл бұрын
Excellent, Thank you!
@chituvabachube8057
@chituvabachube8057 6 ай бұрын
Amazing series!
@patricktamal6366
@patricktamal6366 3 жыл бұрын
Very helpfull Thanks.
@lemannequin7203
@lemannequin7203 Жыл бұрын
excellent
@sauravpathak1802
@sauravpathak1802 3 жыл бұрын
Thank you for the great content. Please keep posting more videos.
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thank you for the kind words :)
@ahmadkelany
@ahmadkelany 2 жыл бұрын
Thanks very much, that's really helpful.
@rogervezaro
@rogervezaro 3 жыл бұрын
Very helpfull video, thank you!
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
I’m glad to hear that, thanks 🙂
@ameyjain3462
@ameyjain3462 3 жыл бұрын
what are AWS APIs. Just by looking at the API its hard to tell whether they are RPS or REST? Or I am missing some pointer to identify?
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Hi Amey, usually the best way to identify if an API is REST or RPC is by reading the API docs. You can also rely on the API URLs to give you hints. REST follows a very structure resource naming pattern whereas RPC will include action oriented naming in the URLs. To be absolutely sure, looking up the docs is the best way.
@imradzi
@imradzi 7 ай бұрын
in order to use RPC such as gRPC you must use its proto file and generate a stub file in any language of your choice.
@aryanrahman3212
@aryanrahman3212 3 жыл бұрын
Just what I was looking for!
@maloxkurambada1129
@maloxkurambada1129 2 жыл бұрын
nice and clean
@aymanimtyaz8529
@aymanimtyaz8529 3 жыл бұрын
This is great!
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Glad you liked it :)
@hn031
@hn031 2 жыл бұрын
Can two of these be combined in a single application?
@ambientcoder5462
@ambientcoder5462 2 жыл бұрын
It depends. Some API providers do provide a combination of API paradigms, but only when there is a clear separation of domain contexts. For example, if you provide a users endpoint using REST, it's probably best not to provide an RPC API for the same users data either. But if it's for a completely different context, then it might be acceptable.
@C0sm1c_Owl
@C0sm1c_Owl 3 жыл бұрын
thanks!
@jinshuenjameslo9647
@jinshuenjameslo9647 2 жыл бұрын
Not enough info on RPC. The pros/cons of rest api and rpc depends on how you implement the apis in the backend. You could have a rest api that does more actions too (search, retrieve, update and return updated resource for example)
@pubdigitalix
@pubdigitalix Жыл бұрын
What happens to SOAP web services? Many enterprises use it a lot.
@femiojo99
@femiojo99 2 жыл бұрын
Great video
@keivansf3459
@keivansf3459 2 жыл бұрын
Thanks!
@gabberfrombcn
@gabberfrombcn 3 жыл бұрын
I guess you meant "you don't want to use verbs" at 6:05
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
You’re right I got that wrong! Thanks for pointing this out.
@debashisdeb472
@debashisdeb472 2 жыл бұрын
I don't understand, why would anyone model Search using REST model, using a PUT, as shown in your video (6:31). Search is more alligned to a GET with query params.
@danielvega646
@danielvega646 5 ай бұрын
Love you.
@faiqkhan7545
@faiqkhan7545 2 жыл бұрын
yo sir, why aren't you posting now a days. please post series like this. thankyou
@ambientcoder5462
@ambientcoder5462 2 жыл бұрын
I apologize for the lack of videos. I hope to find time to make videos in the near future. Thanks for your support, really appreciate it!
@vladasolovei6169
@vladasolovei6169 2 жыл бұрын
cool!
@ross-morozov
@ross-morozov 3 жыл бұрын
7:55 excuse me, could someone explain why we cannot reach a subresource just by going to PUT /users/user-1/deactivate ?
@DBZM1k3
@DBZM1k3 2 жыл бұрын
With regards to this it depends on the layout of your data. But as an example you might keep your user data and order data separate and to keep track of who has ordered what you use the user id. This presents a problem where you have to GET the User data for their id first and then pass that user id to a second GET method for all the orders a User has made. It doesn't necessarily have to be this way but these sorts of things can generally happen with REST APIs. In other APIs like GraphQL you don't have to worry about this sort of thing because relationships between data are generally more expressive. And allows stitching together of different schemas to get the desired result. As with the example above you can get around it with a REST API but only if the data shares some commonality. For situations where the data doesn't share common information you are kind of stuck. Such as grabbing events in your area as well as the predicted weather for those events. Especially if you are using the API of another service such as openweathermap's API.
@vivarantx
@vivarantx 3 жыл бұрын
great
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thanks 🙂
@Lunolux
@Lunolux 3 жыл бұрын
nice
@ambientcoder5462
@ambientcoder5462 3 жыл бұрын
Thanks 🙂
@denemedenemeoğlu-u8i
@denemedenemeoğlu-u8i Жыл бұрын
where is soap?
@artemkravchenko1134
@artemkravchenko1134 Жыл бұрын
From 7:13 Is not true. You can select particular field from entity not downloading whole entity.
@wasd3108
@wasd3108 2 жыл бұрын
deactivate, rest, PATCH /users/user-1 , status: 'deactivated' there's no need for actions
@dennisk648
@dennisk648 Жыл бұрын
There are no such a “problems” in Rest CRUDs. It is not a protocol, but an agreement, a pattern
@TheHalloween81
@TheHalloween81 2 жыл бұрын
Try to reduce noise of background music, when it's on high nodes you are barely audible, TBH it's not adding any value.
@bharatjadhav9075
@bharatjadhav9075 2 жыл бұрын
bas na bhau kiti ata .rest paryant mahit hot ata jara jast hotay
@erik1974Fortal
@erik1974Fortal Жыл бұрын
GRAPHql is always POST.
@artemkravchenko1134
@artemkravchenko1134 Жыл бұрын
7:45 is not true
@PradipLamsal-s8m
@PradipLamsal-s8m 6 ай бұрын
He adds "not in a RESTful manner, anyway" so that should make his statement true.
@darkkuja22
@darkkuja22 Жыл бұрын
the high hats of the rap music in the background are very distracting
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,3 МЛН
Happy birthday to you by Secret Vlog
00:12
Secret Vlog
Рет қаралды 6 МЛН
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 47 МЛН
Павел Черторогов - А нужен ли нам GraphQL?
56:54
HolyJS — конференция для JavaScript‑разработчиков
Рет қаралды 6 М.
Comparing web API types: SOAP, REST, GraphQL and RPC
15:19
AltexSoft
Рет қаралды 96 М.
Distributed Systems 1.3: RPC (Remote Procedure Call)
19:45
Martin Kleppmann
Рет қаралды 103 М.
When RESTful architecture isn't enough...
21:02
Dreams of Code
Рет қаралды 283 М.
REST vs GraphQL | When to choose one over other | Tech Primers
19:42
tRPC, gRPC, GraphQL or REST: when to use what?
10:46
Software Developer Diaries
Рет қаралды 89 М.
API vs. SDK: What's the difference?
9:21
IBM Technology
Рет қаралды 1,4 МЛН
Designing Quality APIs (Cloud Next '18)
40:51
Google Cloud Tech
Рет қаралды 76 М.
Where should you use gRPC? And where NOT to use it!
10:57
CodeOpinion
Рет қаралды 86 М.
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,3 МЛН