Chain

A chain is a intermediate data type to enable complex template values. Chains also provide additional customization, such as marking values as sensitive.

To use a chain in a template, reference it as {{chains.<id>}}.

Fields

FieldTypeDescriptionDefault
sourceChainSourceSource of the chained valueRequired
sensitivebooleanShould the value be hidden in the UI?false
selectorJSONPathSelector to transform/narrow down results in a chained value. See Filtering & Queryingnull
content_typestringForce content type. Not required for request and file chains, as long as the Content-Type header/file extension matches the data. See here for a list of supported types.
trimChainOutputTrimTrim whitespace from the rendered outputnone

See the ChainSource docs for detail on the different types of chainable values.

Chain Output Trim

This defines how leading/trailing whitespace should be trimmed from the resolved output of a chain.

VariantDescription
noneDo not modify the resolved string
startTrim from just the start of the string
endTrim from just the end of the string
bothTrim from the start and end of the string

Examples

# Load chained value from a file
username:
  source: !file
    path: ./username.txt
---
# Prompt the user for a value whenever the request is made
password:
  source: !prompt
    message: Enter Password
  sensitive: true
---
# Use a value from another response
# Assume the request recipe with ID `login` returns a body like `{"token": "foo"}`
auth_token:
  source: !request
    recipe: login
  selector: $.token
---
# Use the output of an external command
username:
  source: !command
    command: [whoami]
    trim: both # Shell commands often include an unwanted trailing newline