Simple cli tool for API testing
with phive
phive install clapi
# 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
# 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