Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not to mention saving headers, tokens, doing multiple requests using the results from the previous, etc.

This guy would say "just use bash" and ignore the average user experience.



You can do all that in a shell script though


Of course you can, but shell scripting really fucking sucks.

One moment you have a properly quoted JSON string, the next moment you have a list of arguments, oops you need to escape the value for this program to interpret it right, but another program needs it to be double-escaped, is that \, \\, or \\\\? What subset of shell scripting are we doing? Fish? modern Linux bash, macOS-compatible bash? The lowest common denominator? My head is spinning already!

If I want to script something I'm writing Python these days. I've lost too much sleep over all the "interesting" WTF situations you get yourself into with shell scripting. I've never used Hurl but it's been on my radar and I think that's probably the sweet spot for tasks like this.


Ok agreed. But you can also just use any scripting language of your choice. Now you have a completely open development platform for your APIs.

I guess parsing cmd line outputs would be annoying. Would be a worth while library to write


That’s mostly what I do when I need to interact with an API:

  _plz() {
    curl [rest of common args]
  }
Then:

  _plz GET endpoint




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: