quartz-cli

Crates.ioquartz-cli
lib.rsquartz-cli
version1.3.1
sourcesrc
created_at2023-06-05 02:14:01.363104
updated_at2024-06-02 00:57:15.747967
descriptionThe command-line tool to build and test HTTP requests.
homepagehttps://github.com/EduardoRodriguesF/quartz
repositoryhttps://github.com/EduardoRodriguesF/quartz
max_upload_size
id882710
size240,714
Eduardo Rodrigues (EduardoRodriguesF)

documentation

README

quartz

The command-line tool to build and test HTTP requests.

About

quartz allows developers to create an API organization project that can be use to share, document and send requests through the terminal.

What quartz is:

  • A tool to test and document HTTP requests aimed for developers who love to stay in the terminal.
  • A command-line alternative to API clients such as Postman and Insomnia.

What Quartz is not:

  • A cURL replacement.

Installation

Bash (Linux)
bash -c "$(curl -fsSL https://raw.githubusercontent.com/EduardoRodriguesF/quartz/master/install.sh)"
Homebrew (MacOS)
brew tap eduardorodriguesf/quartz
brew install quartz
Cargo

Warning: this method is not recommended because it lacks the man page. Prefer the other installation options above.

cargo install quartz-cli

Usage

To create a new project, run:

$ quartz init .

Now start creating your requests with the create command:

$ quartz create users/find --url https://api.example.com/users/{{id}}

$ quartz create users/update -X PATCH --url https://api.example.com/users/{{id}} --json '{"name": "John Doe"}'

$ quartz create users/create -X POST --url https://api.example.com/users/{{id}} --json '{"email": "foo@bar.com", "name": "John Doe"}'

These commands create four handles. A handle is like a path to an endpoint. Similarly to file paths, they are segmented by slash (/). We can see all handles with the ls command:

$ quartz ls
  ---   users
  GET   users/:id
  PATCH users/update
  POST  users/create

Notice that users does not have any method. That's because it is an empty handle, while all others are definitive endpoints that we can send requests to.

To send a request, make sure you are using it by running the use command:

$ quartz use users/find

Now you can send the request with the send command. Since we also defined a variable id in the URL, we need to give this variable a value.

$ quartz send --var id=123

This outputs the response body, but we can also see more details with the last command, which saves our latest request and response for us to fetch the data locally.

$ quartz last res head

You can even output a cURL command to replicate the request:

$ quartz show snippet --var id=123 curl
curl -L 'https://api.example.com/users/123' -X GET

Now that you know the basics of quartz, you can start creating more requests and organizing them in your project. For more information and advanced usage of quartz, check the Documentation.

Documentation

To get started with quartz, head to the install and access the manual page at man quartz!

If you have any trouble, you can also read it in markdown here.

License

This project is under Apache License 2.0.

Commit count: 569

cargo fmt