narc — Nice AWK REST Client

DESCRIPTION

narc is a way to use curl(1) without killing yourself and without having to use some bloatware. It is written entirely with POSIX awk, as things ought to be. Similar to GNU Emacs's restclient-mode but without the Emacs.

USAGE

Pipe a request into narc or pass a file containing the request:

$ cat | narc
POST https://api.mysite.com/foo/bar
Content-Type: application/json
Authorization: Bearer 123457890abcdefghijklmnopqrstuvwxyz
{"prop": "value"}

$ narc file.txt

FILE FORMAT

Items in curly brackets are required, square brackets are optional. If you have a body, you need a Content-Type header unless you're using JSON.

# narc: verbose

#comment

# spaces required for var definitions
# use variables by prepending with $
var-name = var value

{METHOD} {URL}
[header-name]:[header-value]
[body]


{NEXT-METHOD} {NEXT-URL}
[next-header-name]:[next-header-value]
[next-body]

Two empty lines are required between requests, even if there is only one request in the file.

SETTINGS

Set options via a comment containing "narc:" (e.g. # narc: verbose). You can also pass --verbose or -v directly.

FEATURES

MethodsPOST, PUT, DELETE, GET, etc.
HeadersArbitrary request headers
Content typesJSON, x-www-form-urlencoded
VariablesShell-like $var substitution
Multiple requestsSeparated by two blank lines
Verbose modeVia flag or in-file setting

DEPENDENCIES

POSIX awkRequired
curl(1)Required
POSIX shRequired

NAMING

narc is not only an acronym but also means someone who is a snitch, which makes sense because you're sending stuff to the API.

LICENSE

BSD 3-Clause.

DOWNLOAD

Since the demise of NotABug narc is curently unavailable for download. Contact ktnb at NetBSD dot org if interested.

SEE ALSO

restclient.elEmacs REST client mode
curl(1)Transfer data from or to a server