Skip to content

Resto CLI Commands

Abdfn edited this page Dec 25, 2021 · 7 revisions

1. get command

Send a GET request to a URL.

example

resto get https://api.secman.dev
USAGE
  resto get <url> [flags]

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

2. get-latest command

Get the latest tag of a repository from a registry (github, gitlab, bitbucket).

example

resto get-latest denoland/deno

# 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
USAGE
  resto get-latest <repo || id> [flags]

FLAGS
  -r, --registry string   The registry to use
  -t, --token string      The access token to use it the registry requires authentication

3. head command

Send a HEAD request to a URL.

example

resto head https://vercel.com
USAGE
  resto head <url> [flags]

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

4. install command

Install binary app from script URL and run it.

this command is alternative to

  1. curl -sL URL | bash
  2. sh -c "$(wget -O- URL)"
  3. sh -c "$(fetch -o - URL"

demo

install

example

resto install https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh

resto i https://yarnpkg.org/install.sh
USAGE
  resto install <url> [flags]

FLAGS
  -s, --shell string   shell to use

5. patch command

Send a PATCH request to a given URL with a given body.

example

resto patch $URL
USAGE
  resto patch <url> [flags]

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

6. post command

Send a POST request to a given URL with a given body

example

resto post https URL --content-type CONTENT-TYPE -b BODY

# Send a request to a URL and use resto editor
resto post https://localhost:8080/api --content-type json --editor

# Read Body from stdin
cat schema.graphql | resto post https://api.spacex.land/graphql --content-type graphql --body-stdin

# Use Authentecation with Basic Auth or Bearer Token
resto post https://api.secman.dev/api/logins/13 --content-type json --token TOKEN

# Save response to a file
resto post http://localhost:3333/api/v1/hello -b "BODY" --save response.json

7. put command

Send a PUT request to a given URL with a given body.

example

resto patch URL --content-type json
USAGE
  resto patch <url> [flags]

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

8. delete command

Send a DELETE request to a given URL with a given body

example

resto delete https://api.apix.codes --content-type json --token TOKEN
USAGE
  resto delete <url> [flags]

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

9. run command

Send a request via Restofile

demo

run

example

resto run

resto run --file PATH-TO-FILE
USAGE
  resto run  [flags]

FLAGS
  -a, --all           Show all response headers & status
  -f, --file string   Path to Restofile (Default: PATH/Restofile)

examples of restofiles