The Best Way To Send HTTP Requests

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2024
  • Join us on Discord, get the source code (and support the channel 🙂): / amantinband
    Clean Architecture Zero to Hero: dometrain.com/...
    Domain-Driven Design Zero to Hero: dometrain.com/...
    All videos in this playlist: • ASP.NET 8 REST API Tut...
    In this video we'll cover HTTP Files. We'll learn more or less everything there is to know about them:
    1. What are HTTP Files
    2. What is the standard format
    3. How to send HTTP requests via VSCode using the REST Client extension
    4. How to define file variables
    5. How to define environment variables
    6. How to structure the HTTP requests inside a project
    Hope you enjoy!
    Connect with me on 'em socials:
    Twitter: / amantinband
    LinkedIn: / amantinband
    GitHub: github.com/ama...
    Check out all my courses on DomeTrain:
    dometrain.com/...
    Support the channel and get the source code:
    / amantinband
    Thanks for watching, don't forget to like & comment & subscribe! ❤️ 💻

ความคิดเห็น • 121

  • @brandonbraner
    @brandonbraner 3 หลายเดือนก่อน +20

    If you are using postman for single requests you are missing the power of it

    • @ljoffrey
      @ljoffrey 3 หลายเดือนก่อน

      For sure. Bruno is a good alternative too

  • @hoki8296
    @hoki8296 12 วันที่ผ่านมา

    Wow, It will be really helpful for me.
    RIP postman.

  • @vibes992000
    @vibes992000 3 หลายเดือนก่อน +2

    Thanks for the video. Can you also have part 2 of this video where you process the json responses and set new values of environment variables and then send 2nd http request to some another endpoint after that (using json data values from success response data).

  • @ehsangoodarzi2123
    @ehsangoodarzi2123 3 หลายเดือนก่อน

    hi Amichai, thanks for great content.
    just an idea to make it better , it took for times to understand why my visual Studio doesn't recognize .HTTP like yours. and then I installed REST Client extension. now it works.
    edit: you explained it ,sorry my fault😂

  • @SerafimMakris
    @SerafimMakris 4 หลายเดือนก่อน +3

    incredibly good option to send requests through your IDE to check if your application works correctly. My point of view for this http logic are, needed to be add more features to be actual usable like do something with the response body or Code (set attribute based on response message) . :D a big lesson from Amichai again :D

    • @Jianju69
      @Jianju69 3 หลายเดือนก่อน

      I'm still catching up with the rest of the group, but your comment is helpful. So, once we have the application working the way we like, is the .http-file still used in the application (to make HTTP requests,) or is it only for use in the IDE?

    • @exomo1
      @exomo1 3 หลายเดือนก่อน +1

      @@Jianju69 The http files are just for testing and documentation. The application code does not use those files.

  • @BBMG74
    @BBMG74 3 หลายเดือนก่อน

    Wow! Will test it out on Monday. Looks, that it's the first time I really can get rid of Postman

  • @sergenalishiwa9097
    @sergenalishiwa9097 4 หลายเดือนก่อน +5

    Postman supports GRPC and more.

  • @knkootbaoat6759
    @knkootbaoat6759 4 หลายเดือนก่อน +3

    i smashed that subscriber button and looking forward to the future vids

  • @ayyubayyubzada4090
    @ayyubayyubzada4090 4 หลายเดือนก่อน +8

    Cant we declare token as dynamically?
    For example, declare it as global variable in somewhere which requests to the authentication endpoint and fetches the token. Based on the response of auth request(from another file), it uses always the newest valid token for all endpoints.

    • @cliffwakefield
      @cliffwakefield 4 หลายเดือนก่อน +2

      This is the use case I would need to move many of my collections away from Postman.

    • @bogdanb904
      @bogdanb904 4 หลายเดือนก่อน

      @@cliffwakefield I don't think this will ever work with SSO also. Which Postman supports.

  • @shayvt
    @shayvt 4 หลายเดือนก่อน +3

    Another good one! :)
    Thank you Amichai

  • @wildmusical
    @wildmusical 4 หลายเดือนก่อน +2

    Insomnia Rest is also a good client. It is Open source (Apache 2.0), supports GraphQL, REST, WebSockets, SSE and gRPC. You can create test suites, load and edit OpenAPI. It is also extensible with plugins.
    One problem is that the official release now forces you to login (like Postman).
    However, you can use an older release (up to 2023.5.8) or just use a fork which cuts the login.

    • @orecruncher7930
      @orecruncher7930 4 หลายเดือนก่อน +4

      I find this "login trend" somewhat concerning. If I am working on an API that is internal to my organization, the last thing I need is to provide the definition for said API to a 3rd party.

  • @hoanghaitruong9209
    @hoanghaitruong9209 3 หลายเดือนก่อน +1

    haha so how about to share your api to non-dev teammate example QA to try the api?

  • @vitek0585
    @vitek0585 4 หลายเดือนก่อน +6

    It is a great way for simple requests, but when it is necessary to login and then fetch a token to reuse in future requests, this tool is not convenient

    • @geoffreyolson9720
      @geoffreyolson9720 3 หลายเดือนก่อน +1

      Does postman handle that better, because I had the same problem using postman? I would have to login with the browser, then copy the token and manually set the token variable.

    • @vitek0585
      @vitek0585 3 หลายเดือนก่อน

      @@geoffreyolson9720 It is not needed to perform those actions, you just need to parse response and assign extracted value to the variable. That is available in the Tests tab. Here is a short example: let responseData = pm.response.json();
      pm.environment.set("categoryId", responseData[0].id);
      Get first element of the array and assign id value to the variable. After that the categoryId is available for the further requests

    • @vitek0585
      @vitek0585 3 หลายเดือนก่อน +2

      No need to perform those manual actions. There is Tests tab where the response result can be handled. To extract and assign the value to the environment variable just need to parse response: let responseData = pm.response.json();
      pm.environment.set("categoryId", responseData[0].id);
      In the example above I get the first item and assign extracted id to the environment variable. After that the variable can be used as value for the further requests

    • @GabrieleCannata
      @GabrieleCannata 3 หลายเดือนก่อน

      @@vitek0585 Exactly. Not a Postman fan, but that tool is on another level. Also standard OAuth2 authentication are handled automatically.

    • @QuintonCraig
      @QuintonCraig 3 หลายเดือนก่อน

      @@geoffreyolson9720 just use the authorization of the collection, and configure the request to inherit the token from the collection

  • @nirajchandrajoshi
    @nirajchandrajoshi 4 หลายเดือนก่อน +6

    Thank you for this great content ❤.
    I have just one question why you don’t use visual studio ? Or if I ask my question differently then how to use http files in visual studio and where to put token in global variables. Please help.

  • @soverain
    @soverain 4 หลายเดือนก่อน +4

    The fact that environment variables are stored in a vs code workspace config file seems like a big no to me. On my team everyone has its own config file stuffed with plugins configurations.

    • @bogdanb904
      @bogdanb904 4 หลายเดือนก่อน

      Yup. That's a bit of bs. Also would force everyone into using VS Code.

    • @soverain
      @soverain 4 หลายเดือนก่อน

      @@bogdanb904 I think env variables are handled differently on other IDES.

    • @dweblinveltz5035
      @dweblinveltz5035 4 หลายเดือนก่อน

      Also not a fan. There should be some .http specific env file similar to Node's dotenv.

  • @artiefischel2579
    @artiefischel2579 4 หลายเดือนก่อน

    Thanks. I never could figure out Postman.

  • @OlleHellman
    @OlleHellman 3 หลายเดือนก่อน +2

    How do you handle secrets and making sure the token is not checked in?

  • @ChrisWard74
    @ChrisWard74 3 หลายเดือนก่อน +1

    So I can do this all in postman. What about populating the variable with a HTTP call? Say I have an API call to get a token and then want to use that token in other API calls? I can do this in Postman, can it be done with this?

  • @afgone123456
    @afgone123456 4 หลายเดือนก่อน +12

    How to would you do the environment management in VS?

    • @po6577
      @po6577 4 หลายเดือนก่อน +4

      this is probably the most important thing postman can do, without this, i will not event think about switching to any tool

    • @nicholaschun6889
      @nicholaschun6889 4 หลายเดือนก่อน

      That will be a game changer if added to http files

  • @petter.envall
    @petter.envall 4 หลายเดือนก่อน +1

    It is unfortunate that the variables are stored in the vscode settings instead of something like a file in the root of the httpfiles, or project root for that matter

  • @JJ-hg7um
    @JJ-hg7um 4 หลายเดือนก่อน +6

    Thanks for the useful video. I like it. BTW is there a way to automatically fetch the token before a request?

    • @amantinband
      @amantinband  4 หลายเดือนก่อน +4

      You can have the value auto populated via a previous response: github.com/Huachao/vscode-restclient?tab=readme-ov-file#request-variables

  • @Eirenarch
    @Eirenarch 4 หลายเดือนก่อน +3

    I always enjoy when people who advocate for feature folders forget about them when faced with non .cs file extension :)
    Services folder - bad, entities folder - bad, requests folder - totally different, this one is good :)

  • @michaldivismusic
    @michaldivismusic 4 หลายเดือนก่อน +8

    The http file is nice, but is there a way to automatically generate it from an Open API spec? Keeping these up to date sounds like a pain.

    • @Petrovich2049
      @Petrovich2049 4 หลายเดือนก่อน

      It’s a pain only if you already have a big undocumented api. Otherwise for every api update just update the doc, realistically your api doesn’t /shouldn’t change so much that it becomes a drag, and in the end you have a doc written by a human with nuances explained, so later on your consumers waste less of your time with questions.

    • @QuintonCraig
      @QuintonCraig 3 หลายเดือนก่อน

      @@Petrovich2049 Postman will generate the collections based on an OpenAPI spec. If you are new to a proj, this can save a crazy amount of time when you need to get a workable collection online.

  • @gjermundification
    @gjermundification 3 หลายเดือนก่อน +1

    Postman? There is cURL.

  • @abhishekbagchi6052
    @abhishekbagchi6052 4 หลายเดือนก่อน +3

    Cool video. One Question what if I want to update the token in Environment value from a request

  • @Noceo
    @Noceo 3 หลายเดือนก่อน

    Would love to see a video on how/if this can be utilized in a test setting. E.g. calling a number of endpoint in the CD pipeline, after deployment.

  • @exomo1
    @exomo1 3 หลายเดือนก่อน

    Nice video. It looks like VS Code or any other IDE that has support for http files can be used a replacement for postman in a lot of cases. Still it's missing some of the features that make Postman a great tool. What I need the most is authentication (e.g. OAuth2) and token management and a way for scripting requests (e.g. calculating a challenge/reponse value).

  • @ylazerson
    @ylazerson 4 หลายเดือนก่อน

    great video - thanks!

  • @FarukLuki111
    @FarukLuki111 3 หลายเดือนก่อน +1

    Postman was SO MUCH MORE features than what you show here! So far away from „rip postman“!

  • @SouravBanik90
    @SouravBanik90 3 หลายเดือนก่อน

    Can we even use this for writing tests? What’s the point of this? Just to send one request? What if we have to generate the tokens every time for sending a request? How to do that? How to store a value from a request to be sent in another?

  • @djchen1
    @djchen1 4 หลายเดือนก่อน +2

    Does anybody still use curl? I find it handy while working on barebone VMs. Also if you installed tools like proxyman it can trace all http/rest requests made in your system

  • @legui444532
    @legui444532 4 หลายเดือนก่อน

    It's basically using postman with a lot of extra steps, I think i don't need another thing to manage😅, but maybe I will have to learn this at some point of my carreer 😐

  • @KevinLyda
    @KevinLyda 3 หลายเดือนก่อน

    Define an OpenAPI document. Use those tools to test the API, generate the server and client, verify requests and responses, etc.

  • @DrHeinzDoofenshmirtz
    @DrHeinzDoofenshmirtz 4 หลายเดือนก่อน +1

    Please also get into how to avoid to write API keys and other secrets in the .http files.

  • @DeejayMAK11
    @DeejayMAK11 4 หลายเดือนก่อน +3

    Is there a way to create variable which will have dynamic values (from a response of another endpoint)?

    • @blank001
      @blank001 3 หลายเดือนก่อน

      In Postman yes, not sure about this one

  • @syedhoque9057
    @syedhoque9057 4 หลายเดือนก่อน +4

    What tool do you use to annotate ?

  • @MacheteBang
    @MacheteBang 4 หลายเดือนก่อน +3

    More of a vscode question, but is it possible to have multiple workspace settings files? I.e. i want one that has all the "public" settings and a second that has user / password in gitignore (but not in the "user" settings as they are shared across many projects.)

  • @aaartist_yt
    @aaartist_yt 4 หลายเดือนก่อน +2

    I use this extensions for a while (~2-3 years) now. This way to do and organize the requests is still highly underrated. 👍
    PS: How do you to this colored marks in your screencast? Is this a post-production or do you draw them live?

    • @amantinband
      @amantinband  4 หลายเดือนก่อน +1

      Live - it’s called presentify

  • @tchial0
    @tchial0 4 หลายเดือนก่อน +13

    Hahaha! The postman team will hate this video.

    • @amantinband
      @amantinband  4 หลายเดือนก่อน +9

      To be fair postman is an excellent product with a ton of features, but I completely replaced it with http files over the past few years

    • @avatar201206
      @avatar201206 4 หลายเดือนก่อน +6

      What about writing to the env. after a request has been send?

    • @jeffersantosss
      @jeffersantosss 4 หลายเดือนก่อน

      @@avatar201206 great question

    • @matthewbramer7654
      @matthewbramer7654 3 หลายเดือนก่อน

      ​@@amantinbandHow can you use rest client without storing an API key in settings.json?

  • @Mhblabla
    @Mhblabla 4 หลายเดือนก่อน +1

    This is inferior to OpenApi specs and generating clients from that

  • @7th_CAV_Trooper
    @7th_CAV_Trooper 4 หลายเดือนก่อน

    This is slick.

  • @bnssoftware3292
    @bnssoftware3292 4 หลายเดือนก่อน

    Very cool!

  • @Amr-Ibrahim-AI
    @Amr-Ibrahim-AI 3 หลายเดือนก่อน

    Thank you for the comprehensive video.
    What's the software you use to add annotations to the video? I mean those neon-like rectangles and arrows.

  • @DaminGamerMC
    @DaminGamerMC 4 หลายเดือนก่อน +2

    postman only wins because of testing calpabilities and scripts pre and post request

    • @QuintonCraig
      @QuintonCraig 3 หลายเดือนก่อน

      ehh, probably more than that. Runner is pretty huge

  • @gluckchaim
    @gluckchaim 4 หลายเดือนก่อน

    Great content

  • @AslamNazeerShaikh
    @AslamNazeerShaikh 4 หลายเดือนก่อน

    Great thanks ❤🎉

  • @fraserm7163
    @fraserm7163 4 หลายเดือนก่อน

    Hopefully this will support NTLM authentication in the future.

  • @MadanaGopalVankaraboina
    @MadanaGopalVankaraboina 4 หลายเดือนก่อน

    @amantinband please make a play list for rest api you are teaching perfectly like beginner to masterrest api's. if not possiblle please suggest a one rest api tutorial to become master. Thank you

  • @rnavedojr
    @rnavedojr 3 หลายเดือนก่อน

    That's cool, but I personally prefer postman because of all the functionalities it has.

  • @xBodro
    @xBodro 4 หลายเดือนก่อน +4

    Cool but not even close to what postman offers out of the box.

  • @dealerpriest
    @dealerpriest 3 หลายเดือนก่อน

    Superflous use of the phrase "go ahead and..." has popped up all over youtube. I wonder what's the reason behind this?

  • @fedor_U
    @fedor_U 3 หลายเดือนก่อน

    Things get ugly if you try to send encoded form data...

  • @joseluiseiguren7827
    @joseluiseiguren7827 3 หลายเดือนก่อน

    How do you overwrite the token env variable from a login post request?
    So you don't have to paste the token manually in the env variables file
    Thanks

  • @JordanHumbertodeSouza
    @JordanHumbertodeSouza 3 หลายเดือนก่อน

    What about when you need to get the bearer token from request a response header? is there a way to update the env variable on the fly?

  • @fezhaez
    @fezhaez 4 หลายเดือนก่อน +1

    If you delete postman how do you browse the internet?

  • @congjuny
    @congjuny 3 หลายเดือนก่อน +1

    does it do prescript, test, or read variable values from a file etc?

  • @zebraforceone
    @zebraforceone 3 หลายเดือนก่อน

    I use insomnia these days, it's quite good

  • @d47im5e
    @d47im5e 3 หลายเดือนก่อน

    Nah, this one needs some work. For simple rest clients, I think IDEA's http client is better, In any project i can write http files, and i can write javascript code before and after each request that can do tests, set global variables and use them in other requests. But this extension seems good for this use case... Congrats and keep it up!

  • @mauricioaviles6914
    @mauricioaviles6914 3 หลายเดือนก่อน

    Have you used hurl? How does it compare to http files?

  • @Vietnamkid1993
    @Vietnamkid1993 4 หลายเดือนก่อน

    What do you do about storing tokens until they are needed? I use a secure workspace in postman.

  • @DrHeinzDoofenshmirtz
    @DrHeinzDoofenshmirtz 4 หลายเดือนก่อน

    I just watched the intro, and I am thinking: Please convert me!

  • @MrYerak5
    @MrYerak5 3 หลายเดือนก่อน

    Dont forget to ignore files in git with sensative data

  • @ricardoribeiro4560
    @ricardoribeiro4560 4 หลายเดือนก่อน +1

    In the case of authentication, is it possible to automatically fill in the token variable when sending the request?

    • @amantinband
      @amantinband  4 หลายเดือนก่อน +3

      Yes, check this out: github.com/Huachao/vscode-restclient?tab=readme-ov-file#request-variables

  • @chrisnuk
    @chrisnuk 3 หลายเดือนก่อน

    It needs NTLM authorisation added

  • @egozMaster
    @egozMaster 3 หลายเดือนก่อน

    i dont want create files just for make request

  • @tidus93
    @tidus93 4 หลายเดือนก่อน

    Are enviroment variables able to be handled the same way for .http files in Rider/VS aswell?

  • @arsenaghajanyan9741
    @arsenaghajanyan9741 4 หลายเดือนก่อน

    Is there a way to preserve cookies sent from api for the following requests?

  • @devmarkmonster
    @devmarkmonster 4 หลายเดือนก่อน

    The Jetbrains IDE also has a similar plugin, however they are not fully compatible with each other :-(.

    • @kewqie
      @kewqie 4 หลายเดือนก่อน

      Rider supports http files by default, no external plugin needed.

    • @devmarkmonster
      @devmarkmonster 4 หลายเดือนก่อน

      @@kewqie yes but the http files are not 100% compatible

  • @QuintonCraig
    @QuintonCraig 3 หลายเดือนก่อน

    Seems like way more work for no benefit other than to avoid postman.
    MS Edge has basic functionality, imports collections, etx. Probably more useful than this lol

  • @马剑-i2q
    @马剑-i2q 4 หลายเดือนก่อน

    how to stream response as I call OpenAI's API?

  • @cocacola7535
    @cocacola7535 4 หลายเดือนก่อน

    But how can we upload file with http files?

  • @shomari169
    @shomari169 4 หลายเดือนก่อน

    Did you vscode or vs in your coursed please?

  • @cliffwakefield
    @cliffwakefield 4 หลายเดือนก่อน

    Is there a way to define environments and variables that works across IDE's?

    • @pilotboba
      @pilotboba 4 หลายเดือนก่อน

      Probably not... since this is for the VS code plugin. But, would be nice it possible. That said, many times you don't want those stored with your source. Would be nice though it if supported .env files and or environment variables and then all IDS could adopt that.

  • @MaThMaTa1000
    @MaThMaTa1000 4 หลายเดือนก่อน

    Too much of a hassle to work with GraphQL tho

  • @Fanatic17
    @Fanatic17 3 หลายเดือนก่อน

    honestly insomnia is better for defining tokens and variables

  • @monterreymxisfun3627
    @monterreymxisfun3627 4 หลายเดือนก่อน +1

    I still prefer the plain old Python requests library.

  • @amirdaraee
    @amirdaraee 4 หลายเดือนก่อน +2

    Dislike for the clickbait. postman is much more than just a tool for sending requests. Ability to write scripts to run before and after a request, creating collections, the cli, convenient ui and much more.

    • @Petrovich2049
      @Petrovich2049 4 หลายเดือนก่อน

      It’s such a slow and heavy app, costs another subscription too. Many features you listed can be easily replicated in vs code and I’d argue more convenient to use too.
      But personally I’m using Obsidian instead

  • @kukulis100
    @kukulis100 3 หลายเดือนก่อน

    microsoft minion

  • @Dough296
    @Dough296 4 หลายเดือนก่อน

    Nice share !
    Is there a way to create a auth.http file so it retrieves the token + stores it in a workspace variable ?
    This way we should not need to manage tokens by hand.

  • @James-l5s7k
    @James-l5s7k 4 หลายเดือนก่อน +2

    Never liked postman.

    • @T___Brown
      @T___Brown 4 หลายเดือนก่อน

      The tabs system drives me crazy

  • @tommcmeekin1
    @tommcmeekin1 4 หลายเดือนก่อน

    Hey, does anyone know why adding in an api key header works in vs but not in vsc: X-API-KEY: thisismyverysecurekey

    • @nanonukes
      @nanonukes 4 หลายเดือนก่อน +1

      If the api parses your request in a case sensitive manner, you may encounter this behaviour. Rest client makes it all lowercase iirc.