The Config Field

Several endpoints accept a config field as part of the request payload. This field contains the structure of the config field which includes tabs, elements, options and content.

Request payload

At the moment, the config field must be pre-processed before it can be sent along with a request. It must first be JSON encoded and then base64 encoded.

An example within PHP:

$config base64_encode(json_encode($config));

The rules

The config is an array of tabs. It must have at least one tab.

This is an example of a valid config:

[{ "label": "Content", "name": "tab1", "hidden": false, "elements": [{ "type": "text", "name": "el1", "required": false, "label": "Blog post", "value": "

Hello world

", "microcopy": "", "limit_type": "words", "limit": 1000, "plain_text": false }] }]

Tab Structure

The structure of a tab must be a valid JSON object. All of the attributes defined in the example below are required and does not allow additional attributes to be defined:

{ "label": "Content", // string, not empty "name": "tab1", // string, not empty, unique "hidden": false, // boolean "elements": [ /* tab elements */ ] // array }

Element structure

We currently support 5 element types:

  • text
  • files
  • section
  • choice_radio
  • choice_checkbox

All elements must be valid JSON objects. All attributes used within the examples below are required when the corresponding type is provided. No additional attributes are allowed.

Here are some examples of each element type:

{ "type": "text", // string, must be "text" "name": "el1", // string, not empty, unique "required": false, // boolean "label": "Blog post", // string, not empty "value": "<p>Hello world</p>", // string "microcopy": "", // string "limit_type": "words", // string, either "words" or "chars" "limit": 1000, // integer, non-negative "plain_text": false // boolean }

files:

{ "type": "files", // string, must be "files" "name": "el2", // string, not empty, unique "required": false, // boolean "label": "Photos", // string, not empty "microcopy": "" // string }

section:

{ "type": "section", // string, must be "section" "name": "el3", // string, not empty, unique "title": "Title", // string, not empty "subtitle": "<p>How goes it?</p>" // string }

choice_radio:

{ "type": "choice_radio", // string, must be "choice_radio" "name": "el4", // string, not empty, unique "required": false, // boolean "label": "Label", // string, not empty "microcopy": "", // string "other_option": false, // boolean "options": [ /* element options */ ] // array, must have at least one option }

At least two options are required if other_option is set to true.

choice_checkbox:

{ "type": "choice_checkbox", // string, must be "choice_checkbox" "name": "el4", // string, not empty, unique "required": false, // boolean "label": "Label", // string, not empty "microcopy": "", // string "options": [ /* element options */ ] // array, must have at least one option }

Option Structure

All options must be valid JSON objects. Again, all attributes provided within the examples below are required and no additional attributes are allowed.

Most options will look like this:

{ "name": "op1", // string, not empty, unique "label": "Option 1", // string, not empty "selected": false // boolean }

The only exception is the last option for choice_radio element if the other_option attribute is true:

{ "name": "op1", // string, not empty, unique "label": "Other", // string, not empty "selected": true, // boolean "value": "Something" // string }

The value attribute for “other” option must be empty if the option is not selected.

Also, choice_radio must not have more than one option selected.

Great, welcome aboard!

That’s it! You’re signed up to our mailing list and can expect content strategy goodness in your inbox soon.