treq 1.0.0

A Cli client to make HTTP requests for Hacker Users
Documentation

TReq

GitHub Workflow Status GitHub repo size

A Terminal Request HTTP Client.

TReq is a user-friendly Command Line Interface (CLI) HTTP client, designed to be simple and a complete CLI tool to interact with APIs

[!NOTE] TReq, short for Terminal Request, is a user-friendly Command Line Interface (CLI) HTTP client that goes beyond the stateless nature of typical CLI HTTP clients. It's designed to offer a complete tool for interacting with APIs in the terminal.

While traditional CLI HTTP clients excel at quick tasks and small tests, TReq aims to bridge the gap by introducing statefulness, allowing users to store, handle, edit, view, and inspect requests seamlessly, all within the terminal.

Inspired by HTTPie, TReq seeks to implement and extend its main features, making the experience of making HTTP calls in the terminal as simple as possible, without the need for extensive graphical tools.

Features

  • Made to APIs and REST: TReq is tailored for working with APIs, REST, and JSON with minimal effort.
  • HTTPie based: The CLI interface is entirely based on HTTPie, ensuring familiarity for existing users.
  • Easy payload generation : Quickly declare fields for the payload with user-friendly syntax.
  • Persistent Request Storage: Save and edit frequently used requests with simple commands. View details of stored requests.
  • Pretty Outputs: The UX is relevant in a CLI.

Installation

Linux

Go to last release page and install the right binary for your OS.

For most Linux distributions, treq.bin binary can work as expected. You can download it from here and copy to /usr/local/bin/. As the TReq has no many dependecies it should work on most part of the systems.

cp treq.bin /usr/local/bin/treq

Cargo

For any OS, the best way to install TReq is using cargo

Install cargo using rustup and then...

cargo install treq

Usage

For more detailed information on commands and options, refer to the built-in help:

treq --help

Basic GET request

$ treq example.com
$ treq https://google.com
$ treq GET url.org/example

Requests with additional data

# POST request with custom Content-Type header
$ treq POST example.com Content-Type:application/json

# POST request passing a JSON object { "language": "Rust", "food": "pizza" }
$ treq POST example.com language=Rust food=pizza

Saving and storing requests

# After requesting you can save it to do the same request later
$ treq POST example.com name="John Doe" --save-as main-endpoint
$ treq run main-endpoint

# You can also edit the fields and insert new datas in each submit
$ treq run main-endpoint name="Jane" another-field="value"
$ treq run main-endpoint Authorization:None

# Or save it as a new request
$ treq run main-endpoint job="dev" --save-as endpoint-with-job

Contributing

Contributions and feature requests are welcome! Feel free to submit issues or pull requests on our GitHub repository.

Upcoming features