restish
Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
Top Related Projects
GitHub’s official command line tool
🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
Guzzle, an extensible PHP HTTP client
A Commander for modern Go CLI interactions
Quick Overview
Restish is a CLI for interacting with REST-ish APIs and microservices. It aims to be a lightweight, modern alternative to cURL, providing a more user-friendly interface for making HTTP requests and handling responses. Restish supports various authentication methods and offers features like automatic content negotiation and response formatting.
Pros
- Easy-to-use command-line interface for making HTTP requests
- Supports multiple authentication methods (Basic, Bearer, OAuth2)
- Automatic content negotiation and response formatting
- Configurable with environment variables and config files
Cons
- Limited to REST-ish APIs, may not be suitable for all types of API interactions
- Requires learning a new syntax for those already familiar with cURL
- Less widespread adoption compared to more established tools like cURL or Postman
Getting Started
To install Restish, you can use one of the following methods:
# Using Homebrew (macOS and Linux)
brew install rest-cli
# Using Scoop (Windows)
scoop install restish
# Using Go
go install github.com/danielgtaylor/restish@latest
Basic usage example:
# Make a GET request
restish https://api.example.com/users
# Make a POST request with JSON data
restish post https://api.example.com/users name=John age:=30
# Use authentication
restish --auth=mytoken https://api.example.com/protected-resource
For more detailed usage instructions and advanced features, refer to the official documentation at https://rest.sh/.
Competitor Comparisons
GitHub’s official command line tool
Pros of cli
- Official GitHub CLI tool with deep integration into GitHub's ecosystem
- Supports a wide range of GitHub-specific features and workflows
- Regularly updated and maintained by GitHub's team
Cons of cli
- Limited to GitHub-specific operations
- May have a steeper learning curve for users unfamiliar with GitHub's terminology
- Larger installation size due to comprehensive feature set
Code comparison
cli:
gh repo create my-project --public
gh issue create --title "Bug report" --body "Description of the bug"
gh pr create --title "New feature" --body "Implementation details"
restish:
restish post /repos/user/my-project -d '{"name": "my-project", "public": true}'
restish post /repos/user/my-project/issues -d '{"title": "Bug report", "body": "Description of the bug"}'
restish post /repos/user/my-project/pulls -d '{"title": "New feature", "body": "Implementation details"}'
Key differences
- cli focuses on GitHub-specific commands with a more user-friendly syntax
- restish uses a more generic REST API approach, applicable to various services
- cli offers more GitHub-centric features out of the box
- restish provides flexibility for interacting with different REST APIs
Use cases
- Choose cli for dedicated GitHub workflow management
- Opt for restish when working with multiple REST APIs or requiring a more versatile tool
🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
Pros of HTTPie
- More mature and widely adopted project with a larger community
- Extensive documentation and examples available
- Supports plugins for extended functionality
Cons of HTTPie
- Larger codebase and potentially more complex to contribute to
- Python-based, which may not be preferred by some developers
- Slower startup time compared to Restish
Code Comparison
HTTPie:
http GET https://api.example.com/users/123 \
Authorization:"Bearer token123" \
Accept:application/json
Restish:
restish get https://api.example.com/users/123 \
-H "Authorization: Bearer token123" \
-H "Accept: application/json"
Both tools offer similar syntax for making HTTP requests, with HTTPie using a more intuitive command structure and Restish following a more traditional curl-like approach.
Restish is a newer, Go-based alternative to HTTPie, offering faster performance and a smaller footprint. It aims to provide a simpler, more streamlined experience for API testing and interaction. However, it may lack some of the advanced features and extensive documentation found in HTTPie.
HTTPie remains a popular choice due to its rich feature set, wide adoption, and strong community support. It's particularly well-suited for complex API interactions and scenarios where plugin support is beneficial.
The choice between the two largely depends on personal preference, specific use cases, and the desired balance between simplicity and feature richness.
The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
Pros of Insomnia
- User-friendly GUI for API testing and development
- Supports a wide range of authentication methods
- Offers team collaboration features
Cons of Insomnia
- Requires installation and may consume more system resources
- Less suitable for command-line automation or scripting
- May have a steeper learning curve for CLI-focused developers
Code Comparison
Restish (CLI-based):
restish get https://api.example.com/users
Insomnia (JavaScript-based plugin):
const response = await insomnia.send({
url: 'https://api.example.com/users',
method: 'GET'
});
Key Differences
- Interface: Restish is a CLI tool, while Insomnia provides a graphical interface
- Workflow: Restish excels in quick command-line operations, Insomnia in detailed request building and testing
- Extensibility: Insomnia offers a plugin system, Restish focuses on core CLI functionality
- Performance: Restish is lightweight and fast, Insomnia provides a richer but potentially slower experience
Use Cases
- Restish: Ideal for developers who prefer command-line tools and quick API interactions
- Insomnia: Better suited for teams, complex API testing, and those who prefer visual interfaces
Both tools serve the purpose of API testing and interaction but cater to different user preferences and workflows.
Guzzle, an extensible PHP HTTP client
Pros of Guzzle
- More mature and widely adopted PHP HTTP client library
- Extensive documentation and large community support
- Offers advanced features like concurrent requests and request/response streaming
Cons of Guzzle
- Steeper learning curve for beginners
- Heavier footprint, may be overkill for simple API interactions
- PHP-specific, not suitable for cross-language development
Code Comparison
Restish (Command-line interface):
restish https://api.example.com/users
Guzzle (PHP code):
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.example.com/users');
echo $response->getBody();
Key Differences
- Restish is a command-line tool for API interactions, while Guzzle is a PHP library
- Restish focuses on simplicity and quick API testing, Guzzle on comprehensive HTTP client functionality
- Restish is language-agnostic, Guzzle is PHP-specific
- Guzzle provides more advanced features and customization options
- Restish is better suited for quick API exploration, Guzzle for building robust PHP applications
Use Cases
- Choose Restish for: Quick API testing, command-line scripting, language-agnostic development
- Choose Guzzle for: PHP applications, complex HTTP interactions, projects requiring advanced features
A Commander for modern Go CLI interactions
Pros of Cobra
- Mature and widely adopted CLI framework in the Go ecosystem
- Extensive documentation and large community support
- Built-in support for nested subcommands and flags
Cons of Cobra
- Steeper learning curve for beginners
- More verbose code for simple CLI applications
- Requires more boilerplate code for basic functionality
Code Comparison
Cobra:
var rootCmd = &cobra.Command{
Use: "app",
Short: "A brief description of your application",
Run: func(cmd *cobra.Command, args []string) {
// Your code here
},
}
Restish:
#!/usr/bin/env restish
GET https://api.example.com/users
| jq '.[] | {name, email}'
Restish is a command-line REST client focused on simplicity and ease of use for API interactions. It provides a more straightforward approach for making HTTP requests and processing responses.
Cobra, on the other hand, is a comprehensive CLI framework for building complex command-line applications in Go. It offers more flexibility and features for creating sophisticated CLI tools with multiple commands and subcommands.
While Restish excels in quick API interactions and simple scripting, Cobra is better suited for developing full-fledged CLI applications with advanced functionality and structured command hierarchies.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in â like always having the latest API resources, fields, and operations available when they go live on the API without needing to install or update anything. Check out how Restish compares to cURL & HTTPie.
See the user guide for how to install Restish and get started.
Features include:
- HTTP/2 (RFC 7540) with TLS by default with fallback to HTTP/1.1
- Generic head/get/post/put/patch/delete verbs like
curl
or HTTPie - Generated commands for CLI operations, e.g.
restish my-api list-users
- Automatically discovers API descriptions
- Supported formats
- OpenAPI 3.0 / 3.1 and JSON Schema
- Automatic configuration of API auth if advertised by the API
- Shell command completion for Bash, Fish, Zsh, Powershell
- Automatic pagination of resource collections via RFC 5988
prev
andnext
hypermedia links - API endpoint-based auth built-in with support for profiles:
- Content negotiation, decoding & unmarshalling built-in:
- JSON (RFC 8259, https://www.json.org/)
- YAML (https://yaml.org/)
- CBOR (RFC 7049, http://cbor.io/)
- MessagePack (https://msgpack.org/)
- Amazon Ion (http://amzn.github.io/ion-docs/)
- Gzip (RFC 1952), Deflate (RFC 1951), and Brotli (RFC 7932) content encoding
- Automatic retries with support for
Retry-After
andX-Retry-In
headers when APIs are rate-limited. - Standardized hypermedia parsing into queryable/followable response links:
- HTTP Link relation headers (RFC 5988)
- HAL
- Siren
- Terrifically Simple JSON
- JSON:API
- Local caching that respects RFC 7234
Cache-Control
andExpires
headers - CLI shorthand for structured data input (e.g. for JSON)
- Shorthand query response filtering & projection
- Colorized prettified readable output
- Fast native zero-dependency binary
Articles:
This project started life as a fork of OpenAPI CLI Generator.
Top Related Projects
GitHub’s official command line tool
🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
Guzzle, an extensible PHP HTTP client
A Commander for modern Go CLI interactions
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot