cURL - The only HTTP client you'll ever need | Practical Bash & Terminal #9

Sdílet
Vložit
  • čas přidán 20. 05. 2024
  • curl is my favorite command line HTTP client. Yes, there are newer and "fancier" clients available. But curl is great at what it does and you'll find it pre-installed on most linux/unix-like environments.
    As a web-dev I build and use a lot of REST/HTTP APIs in my daily life. While I rely on automated testing a lot, there's always a place for some exploratory testing - and that's when you should be the most comfortable with the http client you probably already have installed.
    This video is a bit longer than usual, as I tried to cram a lot of information into it. Driven by my enthusiasm for curl, I hope you'll find the video as helpful as I found it fun to create it. Enjoy!
  • Věda a technologie

Komentáře • 43

  • @kubucation
    @kubucation  Před 4 lety +18

    0:00 Intro: curl as an HTTP client
    0:40 HTTP GET Requests (with and without -X)
    2:03 HTTP POST with inline body
    3:08 Set custom Headers with -H
    4:20 Read body from file (on POST and other requests with bodies)
    6:37 curl verbose mode
    7:48 Print nothing but the HTTP status code with -w and -o
    9:20 Basic auth with the -u option
    10:28 Set the basic auth header manually
    11:32 Inspect headers with -I
    12:10 Follow redirects
    14:20 Accept invalid HTTPS certificates
    Note: At 4:05 I’m happy about the fact that we have a non-zero exit code. By default curl will not fail if the HTTP status is >299 as Long as the request was successful. To make curl on non-200 status codes you need to provide the -fail option.

  • @427_shreedharshekhar9
    @427_shreedharshekhar9 Před 2 lety +5

    Hey Man....found your channel today....this so wonderful, I wish you hadn't stopped making videos

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

    simplicity is important for this kind of tutorials, thanks for this video!

  • @farrukhijaz
    @farrukhijaz Před 4 lety +4

    An awesome video as always. Thanks for the effort. Keep them coming!

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

    It is absulutly pure pleasure to learn with your videos! Keep it up

  • @vinayrising
    @vinayrising Před 4 lety +14

    This is pure gold!!

  • @codebitcookie8053
    @codebitcookie8053 Před 3 lety +5

    This is very under rated, you are amazing!

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

    I learned a lot here! You clarified a whole new world for me!

  • @juanwagner
    @juanwagner Před rokem +1

    Crisp and clear explanation. I Loved the entire playlist. The way you were progressively adding new concepts one upon the other was amazing. Thank you so much for this series of videos!
    Also, if you are looking for an idea for your next videos. You can teach how to rock the vim + terminal like you do, I saw magic while you were explaining.

  • @Zghanem000
    @Zghanem000 Před rokem +1

    U know these are the only options that i’ve been used in curl command
    Great job buddy, thanks again

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

    Love this video!!!

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

    Great video! Thank you for demonstrating.
    Would you be able to make a full dummies tutorial just on cURL (maybe PHP, javascript, or additional tools if necessary)? Particularly submitting post request and managing the cookies associated with them? I'm struggling submitting forms (even some login forms on some sites, like my propstream acct).
    It would be awesome to learn from you.

  • @iarah2939
    @iarah2939 Před 2 lety

    Really useful, thank you!

  • @zinternetguy9678
    @zinternetguy9678 Před 2 lety

    i never understand http verbs this videos sums it all really glad !

  • @algeriennesaffaires7017

    Thank you i have an idea now about curl

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

    cool stuff from super cool you! ;)

  • @SB-qm5wg
    @SB-qm5wg Před 2 lety

    Thank you.
    I had to add the -o /dev/null before the url. I kept getting options -o not known

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

    Great content liked and subbed

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

    Great video Man,
    Can you make a video on a setup like yours for vim, terminal, etc

  • @RenM908
    @RenM908 Před 3 lety

    How can I save the output from the POST request? So for example I had to make a POST request with credentials and I get back a token. I want to store that token as I need it to make other API requests? Is there a way to store it in a variable?

  • @ModernDays_Faith
    @ModernDays_Faith Před 2 lety

    you are a superman. I like the Vim editor you are using. Do you install it with Yum?

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

    ❤️

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

    How did you open vim during the middle of a command and have the stdin appear inside vim? Or is this just editing?

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

      No editing involved. Make sure EDITOR= points to vim, then press Ctrl-X Ctrl-E to edit the line in vim. The behavior is slightly different between zsh and bash. After :wq zsh will have the command line filled, but not executed. On bash doing :wq will also execute the command directly.

    • @themarcvelazquez
      @themarcvelazquez Před rokem

      @@kubucation I can't get this to work. What terminal are u using? iterm2?

  • @amodhgurung7265
    @amodhgurung7265 Před 2 lety

    nice

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

    Hi. So instead of using high level languages with a bunch of libraries we can use simple and archaic shell scripts or Linux tools? Ok. Can I assume that Linux shell is underrated and is Linux shell the way to go to learn to code for a sys admin? Thanks

    • @kubucation
      @kubucation  Před 2 lety

      Shell vs high-level language isn't the topic of this video. "The only" in the title refers to the omni-present cURL vs. other CLI http tools.
      Knowing cURL well (or at least it's basics) is an incredibly useful skill for anyone that works with http (and other) APIs. Whether you develop them, interact with them, debug them, etc. I'm not advocating for writing your entire web app client with bash. What I'm saying is that being able to quickly fire off an http request from the terminal is a very valuable skill that can a lot of time.

    • @michaelcarnevale5620
      @michaelcarnevale5620 Před 2 lety

      Linux is mostly underrated by people who only use Windows. Linux and Mac offer a similar Unix-based terminal command line interface.

  • @dradic9452
    @dradic9452 Před 4 měsíci

    How did you get into vim like that?

  • @ManojKumar-op8ht
    @ManojKumar-op8ht Před 3 lety +1

    First of all its a very useful video.
    Could you also show how to use curl to download file from any website?

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

      Thanks. To download a file you either need to redirect the output into a file or specify an output file with -o. So you either do "curl -o foo.jpg somehost.com/foo.jpg" or you do "curl somehost.com/foo.jpg > foo.jpg". Both will download into a local file foo.jpg.

  • @kickbuttowsk2i
    @kickbuttowsk2i Před 2 lety

    @kubucation no more new videos? :(

  • @hantusangap
    @hantusangap Před 2 lety

    man this really help me.bettet than books rich dad poor dad by robert kyosaki

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

    How do you jump into vim to edit the terminal like that?

    • @zihuatanejo7741
      @zihuatanejo7741 Před 2 lety

      same question

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

      I googled it:use the edit-and-execute-command,which means press ctrl-x first ,then press ctrl-e

    • @djstreet
      @djstreet Před 2 lety

      @@zihuatanejo7741 Thanks for updating me!

    • @crivion
      @crivion Před 2 lety

      @@zihuatanejo7741 saved the day

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

    #Learn y doing