gurl save

Save a curl request with a memorable name for later use.

Usage

gurl [command] [arguments] [flags]
gurl save [name] [url] [flags]

Description

The save command stores a curl request under a given name. You can specify the URL directly, pass a full curl command with --curl, or pipe curl output from another program.

After saving, use gurl run [name] to execute the request.

Flags

FlagShortDefaultDescription
--collection-cnoneAssign request to a collection
--folder-FnoneAssign request to a folder
--tag-tnoneAdd a tag (can be specified multiple times)
--format-fautoOutput format: auto, json, or table
--descriptionnoneHuman-readable description
--curlnoneFull curl command to parse
--request-XGETHTTP method
--header-HnoneHTTP header (can be specified multiple times)
--data-dnoneRequest body
--bodynoneRequest body (alias for --data)

Aliases

  • s

Examples

Basic save

gurl save "users" https://api.example.com/users

Saves a GET request to fetch users.

Save with method and body

gurl save "create-user" -X POST -H "Content-Type: application/json" -d '{"name":"John"}' https://api.example.com/users

Saves a POST request that creates a user with JSON data.

Save from curl command

gurl save "auth-test" --curl "curl -H 'Authorization: Bearer token' https://api.example.com/me"

Parses the curl command and saves it as a named request.

Pipe curl output

curl -s https://api.example.com/health | gurl save "health-check"

Pipes the curl output and saves it as a health check request.

Save with collection and tags

gurl save "api-users" https://api.example.com/users -c "api" -t "production" -t "v2"

Saves the request to the “api” collection with “production” and “v2” tags.

See also