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

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024

Комментарии • 94

  • @saketmodi6280
    @saketmodi6280 2 года назад +165

    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 2 года назад +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  2 года назад +2

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

  • @maxxiao5651
    @maxxiao5651 2 года назад +4

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

  • @dennycrane2938
    @dennycrane2938 2 года назад +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 Год назад +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.

  • @ankk98
    @ankk98 2 года назад +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  2 года назад +2

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

  • @sultanmuammad595
    @sultanmuammad595 2 года назад +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  2 года назад +2

      Glad you like them and thanks for the positive feedback!

  • @aworden
    @aworden 3 года назад +24

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

    • @ambientcoder5462
      @ambientcoder5462  3 года назад +2

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

    • @r0ck566
      @r0ck566 2 года назад +2

      But why the majority of companies are still using REST?

    • @blitzpark1250
      @blitzpark1250 2 года назад +3

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

  • @TomassoMd
    @TomassoMd Год назад +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.

  • @thatgenzdev
    @thatgenzdev 3 года назад +3

    Best explanation I've seen so far.

  • @chiranjiveesaksham5173
    @chiranjiveesaksham5173 3 года назад +4

    Thanks for explaining in simple and easy way.

  • @debashisdeb472
    @debashisdeb472 2 года назад +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 3 года назад +3

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

  • @Gorlung
    @Gorlung Год назад +5

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

  • @user-ny1rx5ey6w
    @user-ny1rx5ey6w 3 месяца назад

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

  • @josevalentinmoralesrobles9429
    @josevalentinmoralesrobles9429 2 года назад +1

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

  • @wishniks
    @wishniks 2 года назад +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!

  • @sazidahmed3012
    @sazidahmed3012 3 года назад +2

    Nice Presentation with well explanation.

    • @ambientcoder5462
      @ambientcoder5462  3 года назад +1

      Thank you, I’m glad you enjoyed it :)

    • @sazidahmed3012
      @sazidahmed3012 3 года назад +1

      @@ambientcoder5462 You can also create a video on FAST api

  • @ShawnThuris
    @ShawnThuris 3 года назад +1

    Clear and useful comparison.

  • @112_akmalmahardikanp8
    @112_akmalmahardikanp8 3 месяца назад

    really appreciate this. this fit what i am searching for

  • @aymanimtyaz8529
    @aymanimtyaz8529 3 года назад +4

    This is great!

  • @mahdizarepoor8964
    @mahdizarepoor8964 2 года назад

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

  • @MsTheBiggest
    @MsTheBiggest 14 дней назад

    Amazing overview

  • @__init__k917
    @__init__k917 3 года назад +1

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

    • @ambientcoder5462
      @ambientcoder5462  3 года назад +1

      Thanks bro! 🤘🤘 Hope you enjoy the content 🙂

  • @soniablanche5672
    @soniablanche5672 Год назад +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 Год назад

      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.

  • @nuny-vega
    @nuny-vega Месяц назад

    Great video, thanks!

  • @dgillies5420
    @dgillies5420 Год назад

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

  • @audreydelgado2198
    @audreydelgado2198 3 года назад +1

    Great information & explanation. Thank you .

  • @aryanrahman3212
    @aryanrahman3212 3 года назад

    Just what I was looking for!

  • @jeffreycui9933
    @jeffreycui9933 9 месяцев назад

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

  • @sauravpathak1802
    @sauravpathak1802 3 года назад

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

  • @aarontheeranitpongtongmuan233
    @aarontheeranitpongtongmuan233 2 года назад +1

    Great explanation. Thank you so much.

  • @chituvabachube8057
    @chituvabachube8057 4 месяца назад

    Amazing series!

  • @patricktamal6366
    @patricktamal6366 2 года назад +1

    Very helpfull Thanks.

  • @rogervezaro
    @rogervezaro 3 года назад +1

    Very helpfull video, thank you!

  • @lemannequin7203
    @lemannequin7203 Год назад

    excellent

  • @LarryPeteet
    @LarryPeteet Год назад

    Excellent, Thank you!

  • @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)

  • @ameyjain3462
    @ameyjain3462 3 года назад +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  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 4 месяца назад

      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.

  • @ahmadkelany
    @ahmadkelany 2 года назад

    Thanks very much, that's really helpful.

  • @pubdigitalix
    @pubdigitalix Год назад

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

  • @gabberfrombcn
    @gabberfrombcn 2 года назад +2

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

    • @ambientcoder5462
      @ambientcoder5462  2 года назад +1

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

  • @maloxkurambada1129
    @maloxkurambada1129 2 года назад

    nice and clean

  • @hn031
    @hn031 2 года назад +2

    Can two of these be combined in a single application?

    • @ambientcoder5462
      @ambientcoder5462  2 года назад +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 2 года назад +1

    thanks!

  • @femi9594
    @femi9594 2 года назад

    Great video

  • @faiqkhan7545
    @faiqkhan7545 2 года назад +1

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

    • @ambientcoder5462
      @ambientcoder5462  2 года назад +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!

  • @artemkravchenko1134
    @artemkravchenko1134 Год назад

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

  • @keivansf3459
    @keivansf3459 2 года назад

    Thanks!

  • @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 года назад +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.

  • @danielvega646
    @danielvega646 2 месяца назад

    Love you.

  • @vladasolovei6169
    @vladasolovei6169 Год назад

    cool!

  • @vivarantx
    @vivarantx 3 года назад

    great

  • @Lunolux
    @Lunolux 3 года назад

    nice

  • @user-oj6dl6jb4n
    @user-oj6dl6jb4n Год назад

    where is soap?

  • @wasd3108
    @wasd3108 Год назад

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

  • @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.

  • @dennisk648
    @dennisk648 Год назад

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

  • @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

    • @user-ny1rx5ey6w
      @user-ny1rx5ey6w 3 месяца назад

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

  • @darkkuja22
    @darkkuja22 11 месяцев назад

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