Create Conditionals
const url = 'https://example.com/%7B%7Bapp_url%7D/api/v1/workspaces/1/conditionals';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"label":"Over age 30","can_be_used_in_subject_and_preheader":false,"branches":[{"key":"gold_membership","label":"Gold Membership"}],"default_syntax":{"closing":"{% endif %}","branch_values":{"gold_membership":"{% if membership == \'gold\' %}","silver_membership":"{% elsif membership == \'silver\' %}"}},"dynamic_content_profile_syntaxes":{"additionalProperty":{"closing":"{% endif %}","branch_values":{"gold_membership":"{% if membership == \'gold\' %}","silver_membership":"{% elsif membership == \'silver\' %}"}}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/%7B%7Bapp_url%7D/api/v1/workspaces/1/conditionals \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "label": "Over age 30", "can_be_used_in_subject_and_preheader": false, "branches": [ { "key": "gold_membership", "label": "Gold Membership" } ], "default_syntax": { "closing": "{% endif %}", "branch_values": { "gold_membership": "{% if membership == '\''gold'\'' %}", "silver_membership": "{% elsif membership == '\''silver'\'' %}" } }, "dynamic_content_profile_syntaxes": { "additionalProperty": { "closing": "{% endif %}", "branch_values": { "gold_membership": "{% if membership == '\''gold'\'' %}", "silver_membership": "{% elsif membership == '\''silver'\'' %}" } } } }'Creates a new conditional.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Workspace ID
Request Body
Section titled “Request Body”object
Example
Over age 30Whether this conditional is permitted to be used in a subject or preheader.
Example
falseobject
Example
gold_membershipExample
Gold Membershipobject
The closing syntax tag for the conditional block.
Example
{% endif %}Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.
object
Example
{ "gold_membership": "{% if membership == 'gold' %}", "silver_membership": "{% elsif membership == 'silver' %}"}object
A per-DynamicContentProfile syntax entry on a Conditional.
object
The closing syntax tag for the conditional block.
Example
{% endif %}Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.
object
Example
{ "gold_membership": "{% if membership == 'gold' %}", "silver_membership": "{% elsif membership == 'silver' %}"}Responses
Section titled “ Responses ”Successful
object
object
The closing syntax tag for the conditional block.
Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.
object
object
object
A per-DynamicContentProfile syntax entry on a Conditional.
object
The closing syntax tag for the conditional block.
Key-value pairs where the key is the branch key and the value is the opening syntax for that branch.
object
Example
{ "id": 12345, "label": "Over age 30s", "default_syntax": { "closing": "{% endif %}", "branch_values": { "gold_membership": "{% if membership == 'gold' %}", "silver_membership": "{% elsif membership == 'silver' %}" } }, "branches": [ { "key": "gold_membership", "label": "Gold Membership" } ], "can_be_used_in_subject_and_preheader": false, "created_at": "2023-08-23T10:30:00.000Z", "updated_at": "2023-08-23T10:30:00.000Z", "organization_id": 12345, "dynamic_content_profile_syntaxes": { "additionalProperty": { "closing": "{% endif %}", "branch_values": { "gold_membership": "{% if membership == 'gold' %}", "silver_membership": "{% elsif membership == 'silver' %}" } } }}Unauthorized
object
Example
{ "message": "Record not found", "code": "share_link_expired"}Forbidden
object
Example
{ "message": "Record not found", "code": "share_link_expired"}Not Found
object
Example
{ "message": "Record not found", "code": "share_link_expired"}Unprocessable Entity
object
object
Example
{ "errors": { "username": [ "Username is required.", "Username must be unique." ], "email": [ "Invalid email format." ] }}