2017 © Pedro Peláez
 

project clapi

Command line tool for API testing

image

ngabor84/clapi

Command line tool for API testing

  • Tuesday, May 22, 2018
  • by ngabor84
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Codeship Status for ngabor84/clapi, (*1)

Clapi

Simple cli tool for API testing, (*2)

Installation

with phive

phive install clapi

manually

# download the phar file and the public key
wget https://github.com/ngabor84/clapi/releases/download/0.1.0/clapi.phar
wget https://github.com/ngabor84/clapi/releases/download/0.1.0/clapi.phar.asc

# verify the phar with gpg
gpg --keyserver pgp.mit.edu --recv-keys 0xcd54be34da0a1a97
gpg --verify clapi.phar.asc clapi.phar

# add execution permission
sudo chmod +x clapi.phar

# move the downloaded files into usr/local/bin
sudo mv clapi.phar /usr/local/bin/clapi

Usage

# simple request
clapi call http://example.api/tests/1234

available options:
-X --method   Specify the http method (default is GET)
-d --payload  Add payload
-a --auth     Set authentication type (supported: basic, escher, wsse)
-u --key      Set the key for the authentication
-p --secret   Set the secret for the authentication
-s --scope    Set the scope for escher authentication
-H --header   Add custom header to request

examples:
clapi call -X PATCH -d '{"email": "new@email.com"}' https://your-api.com/endpoint/id
clapi call -a basic -u TestUser -p TestPass123 -X DELETE -H "X-Custom-Header: Test" https://your-api.com/endpoint/id
clapi call -a escher -u escher_key -p escher_secret -s credential_scope -X POST -d '{"id": "3", "name": "John Doe", "email": "john@doe.com"}' https://your-api.com/endpoint
clapi call -a wsse -u wsse_key -p wsse_secret https://your-api.com/endpoint

The Versions