In this page

Overview

This page is a collection of techniques that you can use on the YAML-format request body.

Lists in YAML

You can use multiple completely equivalent syntaxes for lists in YAML. Whichever you choose, make sure that the square brackets, hyphen characters, indentation and other details are 100% correct.

# single item (no need for the square brackets!)
to: alice@example.com

# all items in a single line (better for short lists)
to: [ alice@acme.com, bob@acme.com, cecil@acme.com ]

# one item per line (better for long lists)
to:
  - alice@acme.com
  - bob@acme.com
  - cecil@acme.com

Multi-line texts in YAML

If you have a longer piece of text that you don't want to enter to a single line, break that to multiple lines like below.

body: >-
  This piece of text
  spans three lines
  in YAML.

HTML formatting in YAML

If you want to use HTML formatting, just use the HTML tags like normally.

body: This is <span style="color:red">important</span>!

Line-breaks in YAML

If you want to use actual line-breaks in the email body, remember that it is HTML, therefore you have to use <br/> to break text.

body: >-
  Hi,<br/>
  <br/>
  Find the Excel file attached to this email.<br/>
  Happy reading!

Use a YAML validator

If your YAML is rejected by the API, you can find the problematic field or value faster with this online YAML validator.

Questions?

Ask us any time.