DEV Community

Cover image for Resto - A CLI app can send pretty HTTP & API requests with TUI.
abdfn
abdfn

Posted on • Updated on

Resto - A CLI app can send pretty HTTP & API requests with TUI.

Resto

GitHub logo abdfnx / resto

🔗 a CLI app can send pretty HTTP & API requests with TUI

A CLI app can send pretty HTTP & API requests with TUI.

demo

Installation

Using script

  • Shell
curl -fsSL https://git.io/resto | bash
Enter fullscreen mode Exit fullscreen mode
  • PowerShell
iwr -useb https://git.io/resto-win | iex
Enter fullscreen mode Exit fullscreen mode

then restart your powershell

Go package manager

go install github.com/abdfnx/resto@latest
Enter fullscreen mode Exit fullscreen mode

GitHub CLI

gh extension install abdfnx/gh-resto
Enter fullscreen mode Exit fullscreen mode

Via Docker

docker run -it restohq/resto <CMD>
Enter fullscreen mode Exit fullscreen mode

full container:

docker run -it restohq/resto-full
Enter fullscreen mode Exit fullscreen mode

Usage

  • Open Resto UI
resto
Enter fullscreen mode Exit fullscreen mode
  • Send a request to a URL
resto get https://api.github.com
Enter fullscreen mode Exit fullscreen mode
  • Send a request to a URL and use resto editor
resto post https://localhost:3000/v1/login --content-type json --editor
Enter fullscreen mode Exit fullscreen mode
  • Read Body from stdin
cat schema.graphql | resto post https://api.spacex.land/graphql --content-type graphql --body-stdin
Enter fullscreen mode Exit fullscreen mode
  • Use Authentecation with Basic Auth or Bearer Token
# Bearer Token
resto delete https://api.secman.dev/api/logins/13 --content-type json --token TOKEN

# Basic Auth
resto delete https://api.secman.dev/api/logins/13 --content-type json --username USERNAME --password PASSWORD
Enter fullscreen mode Exit fullscreen mode
  • Save response to a file
resto get http://localhost:3333/api/v1/hello --save response.json
Enter fullscreen mode Exit fullscreen mode
  • Install binary app from script URL and run it.
resto install https://yarnpkg.com/install.sh
resto i https://get.docker.com
Enter fullscreen mode Exit fullscreen mode
  • Send a request from Restofile
resto run

# from path
resto run --file ./examples/restofile/basic_request/Restofile
Enter fullscreen mode Exit fullscreen mode
  • Get the latest release/tag from repository
resto get-latest abdfnx/resto

# use another registry
resto get-latest 23028539 --registry gitlab.com

# with access token
resto get-latest spittet/node-postgresql --registry bitbucket.org --token YOUR-ACCESS-TOKEN
Enter fullscreen mode Exit fullscreen mode

Flags

  1. GET & HEAD flags
-H, --headers           Just show the response headers
-j, --just-body         Just show the response body
-p, --password string   The password to use for basic authentication
-s, --save string       Save the response body to a file
-t, --token string      The bearer token to use for authentication
-u, --username string   The username to use for basic authentication
Enter fullscreen mode Exit fullscreen mode
  1. POST, PUT, PATCH, DELETE flags
-b, --body string           The body of the request
-i, --body-stdin            Read the body from stdin
-c, --content-type string   The content type of the body
-e, --editor                Open the editor to edit the body
-H, --headers               Just show the response headers
-j, --just-body             Just show the response body
-p, --password string       The password to use for basic authentication
-s, --save string           Save the response to a file
-t, --token string          The bearer token to use for authentication
-u, --username string       The username to use for basic authentication
Enter fullscreen mode Exit fullscreen mode
  1. install command flags
-H, --hidden         hide the output
-s, --shell string   shell to use default: bash
Enter fullscreen mode Exit fullscreen mode
  1. run command flags
-a, --all           Show all response headers & status
-f, --file string   Path to Restofile (Default: PATH/Restofile)
Enter fullscreen mode Exit fullscreen mode
  1. get-latest command flags
-r, --registry string   The registry to use
-t, --token string      The access token to use it the registry requires authentication
Enter fullscreen mode Exit fullscreen mode

Shortcuts

  • Ctrl+P: Open Resto Panel
  • Ctrl+H: Open Help Guide
  • Ctrl+S: Save Request Body
  • Ctrl+Q: Quit

Documentation

Refer to our Wiki for the documentation.

thank you for your time and don't forgot to star the repo if you like it

Top comments (3)

Collapse
 
chandragie profile image
chandragie

Does the theming works? I tried and however catppuccin messed up with the request form fields. Want to change the theme but wiki does not provide anything

Some comments may only be visible to logged-in visitors. Sign in to view all comments.