Skip to content
Snippets Groups Projects
readme.md 4.54 KiB

REST API CLIENT

This is a bash solution to script REST API calls. The specialties of this component are

  • It was build to simplify http calls and use it in scripts
  • After making a request the response stays is in memory. There is no output to any file to grep something or to cleanup after usage.
  • Its functions feel a bit like class methods, i.e. http.getResponse to get tehe response body or http.getResponseHeader for the Http response header
  • The response an be stored ... and reimportant later. After import you can use the http.get* functions to fetch results from thew former request.

Requirements

  • Bash as shell (runs on Linux - or with Cygwin or other Bash implementations on MS Windows too.)
  • Curl must be in the path
  • optional: sha1sum (for export function with autogenerated filenames only)

Installation

Copy the rest-api-client.sh anywhere you want.

Usage

You must source the rest-api-client.sh. Then its functions are usable in the current process. The "methods" start with "http" dot "[method]".

You should start with http.help to get an overwiew.