diff options
author | Jefferson Julio <[email protected]> | 2022-05-14 21:16:59 -0300 |
---|---|---|
committer | Jefferson Julio <[email protected]> | 2022-05-14 21:16:59 -0300 |
commit | 336438e4cd053f73832cf0c94aef4b29ad2a81ad (patch) | |
tree | 9084d8084c64ffdceaff0b16ccbea86a7aae7c42 /README.md | |
parent | fbf272d4db1a28f4a56a9c8e8de9d0c6de33d218 (diff) | |
download | rest-run-336438e4cd053f73832cf0c94aef4b29ad2a81ad.tar.bz2 rest-run-336438e4cd053f73832cf0c94aef4b29ad2a81ad.zip |
License information, Makefile and README.md
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..de62dc6 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +# rest-run +## Postman? Never heard of it! rest-run is the only REST API client you will ever need! + +### Dependencies + +* Ranger file manager +* HTTPie +* esh template engine + +### Instalation + +If you have GNU Make installed run a +```sh +make install +``` + +Otherwise just copy the rest-run script to some directory on your $PATH + +### Usage + +```sh +# pipe JSON body to rest-run +cat /tmp/body.json | rest-run http://localhost:8080/api/path --body stdin + +# create a PUT request, the default editor will be called to compose the request body +rest-run PUT http://localhost:8080/api/resource + +# replay last request according to the API path, skip editting request body +rest-run PUT http://localhost:8080/api/resource -b last -ne + +# pick request response from history according to the API path and read it with a pager +rest-run PUT http://localhost:8080/api/resource -r last -p +``` + +###### Positional arguments + +You must provide the API URL. An HTTP verb preceding it is accepted if present. + +###### Options + +* -x|--method HTTP Method +* -b|--body Request body source, must be one of the following options: + * default - create a request body using the default editor + * last - use the last request + * history - pick from the request history + * stdin - reads from piped input +* -r|--response Request response handling, must be one of the following options: + * default - store the request on cache + * last - read last request, skip request + * history - pick from the response history, skip request +* -ne|--no-edit Skip request editting. Ignored when --body is set to default +* -h|--header Header string. Ex: "Authorization: Bearer 123" +* -p|--paginate Paginate request response + +rest-run parses your request body with a simple template engine called esh. You can embed shell scripts/commands in your request file surrouning it with <% my-command %> or <%= $MY_ENV_VARIABLE %> + +Example: +```sh + echo '{ + "username": "<%= $USER %>", + "device": "<%= $HOSTNAME %>", + "created_at": "<% date +"%FT%T.000Z" %>", + "password": 123 + }' | rest-run POST https://postman-echo.com/post +``` |