Skip to content

fft template save ​

Save a request body as a template

Save a request body so you can send it again.

The body comes from --file, --data or --from:

fft template save rush --file body.json
fft order get ORDER-1 -o json | fft template save rush --file -
fft template save rush --from createOrder        seeds from the spec's example

--operation records the operation a --file or --data body is for, the way --from does for the example it seeds. The id must be one this fft knows and one that takes a body:

fft template save rush --operation addOrder --file body.json

--param declares a parameter: a short name for a path inside the body, so that '--set email=…' works instead of '--set order.consumer.email=…'. Give it a default with a second '=', and mark it required with --require:

--param qty=order.items.0.quantity=1
--require email=order.consumer.email

A top-level "version" is dropped on the way in. A version is only true of the entity at the moment it was read, and replaying a stale one is a guaranteed 409 — a saved body that still carries one is a trap for whoever finds it next. Put one back at render time with --set version=N if you really want that.

--local writes ./.fft/templates instead of your own directory. That file is meant to be committed, so read it first: a body captured from real work carries real facility ids, order ids and consumer emails, and git history is not something you can quietly edit later. A body that looks like it carries a credential (a password, secret, API key, token or Authorization header) is refused outright for --local without --yes.

Usage ​

fft template save <name> [flags]

Flags ​

      --data string           Request body: inline JSON, @file, or '-' for stdin
      --description string    What this template is for
      --file string           JSON file holding the request body ('-' for stdin)
      --force                 Replace a template of the same name
      --from string           Seed the body from this operation's example
      --local                 Write to ./.fft/templates, the directory this repository commits
      --operation string      Record the operation (an operationId) the body is sent with
      --param stringArray     Declare a parameter: --param name=path[=default] (repeatable)
      --require stringArray   Declare a required parameter: --require name=path (repeatable)

See also ​

This command also accepts the global flags.

An independent open-source project — not affiliated with, endorsed by, or supported by fulfillmenttools.