gurl edit

Edit a saved request using your default editor or command-line flags.

Usage

gurl edit [name] [flags]

Description

The edit command modifies a saved request. Without flags, it opens the request in your default editor. With flags, it updates specific fields directly.

Flags

FlagShortDefaultDescription
--method-XnoneHTTP method
--url-unoneRequest URL
--header-HnoneAdd HTTP header
--remove-headernoneRemove a header by name
--body-dnoneRequest body
--collection-cnoneMove to collection
--tag-tnoneAdd a tag
--pre-scriptnoneScript to run before request
--post-scriptnoneScript to run after request
--run-ifnoneConditional expression for running this request
--extractnoneAdd or replace extraction rule as VAR_NAME=METHOD:EXPRESSION
--remove-extractnoneRemove extraction rule by variable name
--assert-anoneAdd an assertion
--authnoneAuthentication type: basic, bearer, apikey, oauth1, oauth2, awsv4, digest, ntlm, or none
--auth-paramnoneAuthentication parameter as key=value (can be specified multiple times)

Aliases

  • e

Examples

Edit in default editor

gurl edit "my-request"

Opens “my-request” in your default editor.

Change URL

gurl edit "my-request" --url https://api.new-example.com/users

Updates the URL for the request.

Update method and headers

gurl edit "api-users" -X POST -H "Authorization: Bearer new-token"

Changes the method to POST and updates the Authorization header.

Add pre-script

gurl edit "auth-request" --pre-script "./auth-script.sh"

Adds a pre-request script to the “auth-request”.

Add flow metadata

gurl edit "get-profile" \
  --run-if "token != ''" \
  --extract userId=jsonpath:$.id \
  --post-script "gurl.setVariable('seenProfile', 'true')"

Adds a run condition, an extraction rule, and a post-response script. run-if supports simple VAR == VALUE and VAR != VALUE checks.

Update saved auth

gurl edit "profile" \
  --auth bearer \
  --auth-param token='{{token}}'

Replaces the request’s saved auth config with bearer auth. Each --auth-param must be a key=value pair and may be repeated.

Clear saved auth

gurl edit "profile" --auth none

Clears the request’s saved auth config. --auth none cannot be combined with --auth-param.

See also