This project is now archived. If you want to use Hoppscotch as a CLI client for CI/CD purposes, please use the new Hoppscotch CLI.
Send HTTP requests from terminal and Generate API Docs. An alternative to cURL, httpie ⚡️
$ sh -c "$(curl -sL https://git.io/getpwcli)"- Clone the repo
$ git clone https://github.com/hoppscotch/hopp-cli.git- Build and install
$ make
$ sudo make install- You can download prebuilt binaries from the Releases page.
- Supported platforms:
- Linux (x64, x86)
- Mac (x64)
- Windows (x64, x86)
IMPORTANT: Not tested on Windows, please leave your feedback/bugs in the Issues section
- You can install from AUR
- There are three different packages available
| Name | Link | Description |
|---|---|---|
| hopp-cli-bin | https://aur.archlinux.org/packages/hopp-cli-bin/ | Pre-built binary |
| hopp-cli | https://aur.archlinux.org/packages/hopp-cli/ | Compiled from latest release |
| hopp-cli-git | https://aur.archlinux.org/packages/hopp-cli-git/ | Compiled from latest commit |
Install by
brew install athul/tap/hopp-cliYou can download pre-built binaries from the Releases page.
Alternatively, you can install hopp-cli via Scoop:
scoop install hopp-cliPutting Simply: Just pass the URL to the request method
- GET :
$ hopp-cli get <url> - POST:
$ hopp-cli post <url> - PATCH:
$ hopp-cli patch <url> - PUT :
$ hopp-cli put <url> - DELETE:
$ hopp-cli delete <url>
Example for a POST request:
$ hopp-cli post https://reqres.in/api/users/2 -c js -b '{"name": "morp","job": "zion resident"}'sendfor testing multiple endpointsgenfor generating API docs from Collection
This can be used to test multiple endpoints from the hoppscotch-collection.json file.
The output will only be the
statuscode
Example:
$ hopp-cli send <PATH to hoppscotch-collection.json>Sample output:
The gen command generates the API documentation from hoppscotch-collection.json file and serves it as a static page on port 1341.
Example:
$ hopp-cli gen <PATH to hoppscotch-collection.json>Sample Hosted site: https://hopp-docsify.surge.sh/
Powered by Doscify
Flags:
browserorbto toggle whether the browser should open automatically [Boolean]portorpfor specifying the port where the server should listen to [Integer]
(optional)
-tor--tokenfor a Bearer Token for Authentication-ufor theUsernamein Basic Auth-pfor thepasswordin Basic Auth
-cor--ctypefor the Content Type-bor--bodyfor the Data Body, this can be of json, html or plain text based on the request.
Enclose the body in Single Quotes(')
Content Types can be of
| Short Code | Content Type |
|---|---|
js |
application/json |
html |
text/html |
xml |
application/xml |
plain |
text/plain |
-Hor--headermay be specified multiple times to include headers with the request.
Example:
$ hopp-cli get -H 'X-Api-Key: foobar' -H 'X-Api-Secret: super_secret' https://example.com/api/v1/accountsIn addition to -b/--body, you may provide a request body via stdin.
If you combine this method with the -b flag, the body provided with -b will be ignored.
Example with Pipes
$ echo '{"foo":"bar"}' | hopp-cli post -c js http://example.comExample with Redirection
$ cat myrequest.json
{
"foo": "bar"
}
$ hopp-cli post -c js http://example.com <myrequest.jsonIn addition to providing request body via -b / --body flag and stdin,
you can also use -e / --editor flag which opens default text-editor in your system.
Example:
$ hopp-cli post https://reqres.in/api/users/2 -c js -eIt will preferrably open editor based on $EDITOR environment variable.
For example:
If the environment variable is $EDITOR=code it will open VSCode for request-body input. Else, it will use default editor value based on the OS.
| OS | Default Editor |
|---|---|
| Linux | nano |
| macOS | nano |
| Windows | notepad |