Blocks

Create a block

Creates a block. The HTML and plain text are validated, including Liquid syntax and the customer attributes they use.

post/blocks

Request

  • Base URL
    https://api5.optimove.net/content/v1
  • URL
    https://api5.optimove.net/content/v1/blocks
  • Auth
    API key in header X-API-KEY

Request body

tagNamestring required

Tag name that templates use to reference the block. Must be unique.

namestring required

Display name of the block. Must be unique among the tenant's blocks.

folderIdstring uuid nullable

Folder to put the block in. Leave it out for the root folder. Must be an existing folder.

descriptionstring nullable

Free-text description of the block.

htmlstring required

HTML content of the block. Can contain Liquid personalization tags.

plaintextstring required

Plain-text version of the content. Stored exactly as sent. The API doesn't generate it from the HTML, autoGeneratePlainText takes effect only in UI.

editorDatastring nullable

Editor state as a serialized string. Required when isSavedRow is true.

editorType'html' | 'visual' required

Editor the content is built with:

  • html: HTML code editor
  • visual: drag-and-drop editor
autoGeneratePlainTextboolean

UI only. Whether the Optimove UI generates the plain text from the HTML when the block is edited there. The API never generates plain text. It stores plaintext exactly as sent, whatever this value is.

isSavedRowboolean

Whether the block is available as a saved row in the visual editor. Allowed only when editorType is visual and editorData is set.

Example request

{
  "tagName": "summer-sale-banner",
  "name": "Summer sale banner",
  "html": "<div>Hi {{customer.FirstName}}, our summer sale has started.</div>",
  "plaintext": "Hi {{customer.FirstName}}, our summer sale has started.",
  "editorType": "html",
  "code": {
    "header": "{% assign greeting = \"Hello\" %}"
  }
}

Response

The block was created.

idstring uuid required
tagNamestring required
namestring required
folderIdstring uuid nullable
descriptionstring nullable
htmlstring required
plaintextstring required
editorDatastring nullable
editorType'html' | 'visual' required

Editor the content is built with:

  • html: HTML code editor
  • visual: drag-and-drop editor
autoGeneratePlainTextboolean required

UI only. Whether the Optimove UI generates the plain text from the HTML when the block is edited there. The API never generates plain text: plaintext is returned exactly as it was stored.

isSavedRowboolean required
createdAtstring date-time required
createdBystring required

Name of the API key or user that created the block.

updatedAtstring date-time required
updatedBystring required

Name of the API key or user that last updated the block.

Example response

{
  "tagName": "summer-sale-banner",
  "name": "Summer sale banner",
  "html": "<div>Hi {{customer.FirstName}}, our summer sale has started.</div>",
  "plaintext": "Hi {{customer.FirstName}}, our summer sale has started.",
  "editorType": "html",
  "code": {
    "header": "{% assign greeting = \"Hello\" %}"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.