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

Sdílet
Vložit
  • čas přidán 25. 08. 2024

Komentáře • 94

  • @saketmodi6280
    @saketmodi6280 Před 2 lety +162

    rest api : good for exposing crud operations
    rpc : good for exposing several actions
    Graphql: Good when need data filtering on client side.(Flexibility)

  • @wololo1657
    @wololo1657 Před 2 lety +24

    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  Před 2 lety +2

      That's some really useful feedback, I will keep that in mind for future videos! Thanks for the support!

  • @maxxiao5651
    @maxxiao5651 Před 2 lety +4

    Best IT explanation video watched ever! Clear and Precise! Love it!

  • @dennycrane2938
    @dennycrane2938 Před 2 lety +10

    "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.

  • @swainscheps
    @swainscheps Před rokem +1

    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.

  • @sultanmuammad595
    @sultanmuammad595 Před 2 lety +9

    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  Před 2 lety +2

      Glad you like them and thanks for the positive feedback!

  • @ankk98
    @ankk98 Před 2 lety +11

    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  Před 2 lety +2

      I’m glad you found the series useful! Thanks for the suggestion, I’ll keep that in mind for future videos 👌

  • @aworden
    @aworden Před 3 lety +24

    Great explanation Thanks! And thanks for mentioning RPC APIs. They are the right solution 99% of the time in my experience.

    • @ambientcoder5462
      @ambientcoder5462  Před 3 lety +2

      Thanks for your support!
      And yes you’re absolutely right - RPC is a good fit in most cases.

    • @r0ck566
      @r0ck566 Před 2 lety +2

      But why the majority of companies are still using REST?

    • @blitzpark1250
      @blitzpark1250 Před 2 lety +3

      @@r0ck566 I think it is 'cause rpc is built using http2 and many client+server architecture is on http/1.1

  • @chiranjiveesaksham5173
    @chiranjiveesaksham5173 Před 3 lety +4

    Thanks for explaining in simple and easy way.

  • @thatgenzdev
    @thatgenzdev Před 3 lety +3

    Best explanation I've seen so far.

  • @debashisdeb472
    @debashisdeb472 Před rokem +4

    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.

  • @nikthough3110
    @nikthough3110 Před 3 lety +3

    The way you explain is just simply golden. Subscribed and Liked.

  • @Gorlung
    @Gorlung Před rokem +5

    Why is for search in your REST example the PUT method being used and not the GET method?

  • @TomassoMd
    @TomassoMd Před rokem +6

    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.

  • @user-ny1rx5ey6w
    @user-ny1rx5ey6w Před 3 měsíci

    Thank you very much. Saved me a lot of hassle.

  • @112_akmalmahardikanp8
    @112_akmalmahardikanp8 Před 2 měsíci

    really appreciate this. this fit what i am searching for

  • @josevalentinmoralesrobles9429

    Great video, easy to understand and with a lot of useful information.

  • @ShawnThuris
    @ShawnThuris Před 3 lety +1

    Clear and useful comparison.

  • @wishniks
    @wishniks Před 2 lety +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!

  • @alvarovega2477
    @alvarovega2477 Před měsícem

    Great video, thanks!

  • @mahdizarepoor8964
    @mahdizarepoor8964 Před 2 lety

    That was a neat video about them . I really enjoyed you explanation . Thanks

  • @sazidahmed3012
    @sazidahmed3012 Před 3 lety +2

    Nice Presentation with well explanation.

  • @MsTheBiggest
    @MsTheBiggest Před dnem

    Amazing overview

  • @aymanimtyaz8529
    @aymanimtyaz8529 Před 3 lety +4

    This is great!

  • @audreydelgado2198
    @audreydelgado2198 Před 3 lety +1

    Great information & explanation. Thank you .

  • @aarontheeranitpongtongmuan233

    Great explanation. Thank you so much.

  • @aryanrahman3212
    @aryanrahman3212 Před 3 lety

    Just what I was looking for!

  • @__init__k917
    @__init__k917 Před 3 lety +1

    Brooo you are awesome 🤘🤘🤘, I am grateful to discover this channel

  • @chituvabachube8057
    @chituvabachube8057 Před 3 měsíci

    Amazing series!

  • @LarryPeteet
    @LarryPeteet Před rokem

    Excellent, Thank you!

  • @patricktamal6366
    @patricktamal6366 Před 2 lety +1

    Very helpfull Thanks.

  • @dgillies5420
    @dgillies5420 Před rokem

    6:05 I think mean, "You don't want to use _verbs_ ..." not "nouns"

  • @sauravpathak1802
    @sauravpathak1802 Před 3 lety

    Thank you for the great content. Please keep posting more videos.

  • @soniablanche5672
    @soniablanche5672 Před rokem +9

    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 Před rokem

      Yahoo's Elide implements this very well

    • @eugenpaval
      @eugenpaval Před rokem

      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.

  • @lemannequin7203
    @lemannequin7203 Před rokem

    excellent

  • @rogervezaro
    @rogervezaro Před 3 lety +1

    Very helpfull video, thank you!

  • @ahmadkelany
    @ahmadkelany Před 2 lety

    Thanks very much, that's really helpful.

  • @jeffreycui9933
    @jeffreycui9933 Před 9 měsíci

    Thank you for the excellent video. But why use PUT for a search instead of using GET?

  • @maloxkurambada1129
    @maloxkurambada1129 Před 2 lety

    nice and clean

  • @ameyjain3462
    @ameyjain3462 Před 3 lety +2

    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  Před 3 lety

      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 Před 4 měsíci

      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.

  • @C0sm1c_Owl
    @C0sm1c_Owl Před 2 lety +1

    thanks!

  • @jinshuenjameslo9647
    @jinshuenjameslo9647 Před 2 lety

    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)

  • @keivansf3459
    @keivansf3459 Před 2 lety

    Thanks!

  • @pubdigitalix
    @pubdigitalix Před rokem

    What happens to SOAP web services? Many enterprises use it a lot.

  • @hn031
    @hn031 Před 2 lety +2

    Can two of these be combined in a single application?

    • @ambientcoder5462
      @ambientcoder5462  Před 2 lety +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.

  • @femi9594
    @femi9594 Před 2 lety

    Great video

  • @gabberfrombcn
    @gabberfrombcn Před 2 lety +2

    I guess you meant "you don't want to use verbs" at 6:05

    • @ambientcoder5462
      @ambientcoder5462  Před 2 lety +1

      You’re right I got that wrong! Thanks for pointing this out.

  • @danielvega646
    @danielvega646 Před 2 měsíci

    Love you.

  • @user-oj6dl6jb4n
    @user-oj6dl6jb4n Před rokem

    where is soap?

  • @ross-morozov
    @ross-morozov Před 3 lety

    7:55 excuse me, could someone explain why we cannot reach a subresource just by going to PUT /users/user-1/deactivate ?

    • @DBZM1k3
      @DBZM1k3 Před 2 lety +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.

  • @artemkravchenko1134
    @artemkravchenko1134 Před rokem

    From 7:13 Is not true. You can select particular field from entity not downloading whole entity.

  • @faiqkhan7545
    @faiqkhan7545 Před 2 lety +1

    yo sir, why aren't you posting now a days. please post series like this. thankyou

    • @ambientcoder5462
      @ambientcoder5462  Před 2 lety +1

      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 Před rokem

    cool!

  • @vivarantx
    @vivarantx Před 3 lety

    great

  • @Lunolux
    @Lunolux Před 3 lety

    nice

  • @wasd3108
    @wasd3108 Před rokem

    deactivate, rest, PATCH /users/user-1 , status: 'deactivated'
    there's no need for actions

  • @TheHalloween81
    @TheHalloween81 Před 2 lety

    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 Před 2 lety

    bas na bhau
    kiti ata .rest paryant mahit hot ata jara jast hotay

  • @dennisk648
    @dennisk648 Před rokem

    There are no such a “problems” in Rest CRUDs. It is not a protocol, but an agreement, a pattern

  • @artemkravchenko1134
    @artemkravchenko1134 Před rokem

    7:45 is not true

    • @user-ny1rx5ey6w
      @user-ny1rx5ey6w Před 3 měsíci

      He adds "not in a RESTful manner, anyway" so that should make his statement true.

  • @erik1974Fortal
    @erik1974Fortal Před rokem

    GRAPHql is always POST.

  • @darkkuja22
    @darkkuja22 Před 11 měsíci

    the high hats of the rap music in the background are very distracting