Ain was built to enable scripting of input and further processing of output via pipes. It targets users who work with many API:s using a simple file f

jonaslu / ain

submited by
Style Pass
2021-08-17 01:00:08

Ain was built to enable scripting of input and further processing of output via pipes. It targets users who work with many API:s using a simple file format. It uses curl or httpie to make the actual calls.

You need curl or httpie installed and available on your $PATH. The easiest way to test this is to open up a shell and type curl or http. If there's any output you're good to go.

The template files can be named anything but some unique ending-convention such as .ain is recommended so you can find them easily.

Ain accepts one or more template-files as a mandatory parameter. As sections combine or overwrite where it makes sense you can better organize API-calls into hierarchical structures with increasing specificity. An example would be setting the [Headers], [Backend] and [BackendOptions] in a base template file and then specifying the specific [Host], [Method] and [Body] in several template files, one for each API-endpoint. You can even use an alias for things you will always set.

Adding an exclamation-mark (!) at the end of the template file name makes ain open the file in your $EDITOR (or vim if not set) so you can edit the file. The edit is not stored back into the template file and used only this invocation.

Leave a Comment
Related Posts