Hugo Hacker News

Show HN: Ain is a terminal API client

jonaslu 2021-08-17 00:38:31 +0000 UTC [ - ]

Posted here because I'd like feedback on it.

The backstory is: Ain was born out of the frustration of working with many API-endpoints in GUI clients. While pretty, I could't use any shell-scripts or commands such as `uuidgen` as input to the endpoints without copy pasting from a terminal. And I had to copy-paste the resulting output back into the terminal to further slice and dice it.

I had become a human pipe and my ctrl+c, ctrl+v fingers were hurting.

It's done in go and uses curl and or httpie for making the actual calls.

the_biot 2021-08-17 09:08:10 +0000 UTC [ - ]

It's a HTTP API client. There are other things than HTTP out there :-)

Also, don't shell out to curl, that's weak sauce. Use libcurl, it has Go bindings.

jonaslu 2021-08-18 01:12:26 +0000 UTC [ - ]

Right, while theoretically possible to do other things than HTTP with the curl backend the other sections do not make sense and it's purpose is HTTP. I'll stress the HTTP in the future, thanks!

What would be the benefits of using libcurl instead of shelling out? Would that work without pain on windows?

somidscr21 2021-08-18 04:27:32 +0000 UTC [ - ]

I think the point is that API isn't just used for HTTP and your title assumes HTTP API

noloblo 2021-08-17 02:25:04 +0000 UTC [ - ]

exactly what i have been looking for, can it read it from a text log file and pipe into python or go script if so how?

jonaslu 2021-08-18 00:58:06 +0000 UTC [ - ]

Great :)

I don't understand what you mean, what do you want to read from a text-file?

Piping it into python or go: Sure. Just read from STDIN in your python or go binary. Or use temp-file redirection if you need to the results from a file.