Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 1.39 KB

render.md

File metadata and controls

54 lines (43 loc) · 1.39 KB
title type order
Rendering Templates
api
4

Render API

The render api allows you to render a template with data, using the exact same rendering workflow that Sendwithus uses when delivering your email.

NOTE -- All parameters are mandatory unless otherwise noted.

Render a Template with Data

POST /render

Params:

  • template -- Template ID
  • template_data -- Object containing email template data
  • version_id (optional) -- Version ID obtained from /templates/(:template_id)/versions
  • version_name (optional) -- Version name that you want rendered (provide either a version_name or a version_id, not both)
  • locale (optional) -- Template locale to render
  • strict (optional) -- Render in strict mode (fails on missing template data)

Sample Request:

{
    "template": "tem_A5RHVP6CnRbS34UysLjYHx",
    "template_data": { "amount": "$12.00" },
    "version_id": "ver_r4nd0ml3tt3rsv15h4l0l",
    "locale": "en-US",
    "strict": true
}

Sample Response:

{
    "success": true,
    "status": "OK",
    "template": {
        "id": "ver_r4nd0ml3tt3rsv15h4l0l",
        "name": "Template name",
        "version_name": "Template version name",
        "locale": "en-US"
    },
    "subject": "RENDERED SUBJECT WITH DATA",
    "html": "RENDERED HTML BODY WITH DATA",
    "text": "RENDERED TEXT BODY WITH DATA"
}