Getting Started

Content Objects

Formatting responses

Some resources in the Plate API include a dynamic set of content fields. These are defined in the Plate Dashboard and are specific to certain resource types, such as:

  • Site Translations
  • Posts
  • Sections
  • Elements

Resources with customizable content fields are referred to as content objects. These objects have special handling in both requests and responses.


Responses for Content Objects

When retrieving a content object (e.g., via GET), the response includes a content section inside the attributes object. This contains all defined content fields for that object.

Example response

{
  "data": {
    "id": 1,
    "type": "elements",
    "attributes": {
      "content": {
        "categories": {
          "value": [789],
          "type": "reference",
          "subtype": "posts",
          "content_field_id": 123
        },
        "name": {
          "value": "Pied Piper",
          "type": "string",
          "content_field_id": 456
        }
      },
      ...
    }
  }
}

How It Works

Each key inside the content object represents a dynamic content field for the resource. For each content field, the following properties are returned:

PropertyDescription
valueThe value of the field (can be a string, integer, or array).
typeType of content field, e.g. "string", "reference", or "array".
subtype (optional)Further detail on the type, used with "reference" or "array" fields.
content_field_idThe unique ID of the content field definition.

Value Behavior by Type

  • String/Integer fields return a simple value.
  • Reference fields return an array of IDs (e.g., [12, 23, 24]), referencing other resources.
    • subtype indicates the resource type, e.g., "posts".
  • Array fields return an array of values.
    • If subtype is "attachments", it's an array of attachment IDs.
    • If subtype is "text", it's an array of strings, which is the actual value of the content field.

Requests for Content Objects

When creating or updating content objects (e.g., via POST or PUT), you can include values for dynamic content fields directly in the request payload.

Example Request

{
  "data": {
    "name": "A name for the new element",
    "categories": [
      {
        "id": 25
      },
      {
        "title": "A title for a newly created reference post"
        *// additional fields for new post...*
      }
    ]
  }
}

How to Send Content Field Data

Field TypeFormat
string, choiceSend the raw value ("Some Text" or 42).
mediaSend the ID of an existing attachment.
referenceSend an array of objects:
- { "id": 25 } for referencing existing objects.
- { "title": "New Post" } for creating a new nested object inline.

Nested references are supported. You can include the full data for referenced objects within the request, eliminating the need to create them in advance. In the request example, the field categories (with type reference) will be set with two referenced objects. One existing object with id=25, and one new object which will have the value "A title for a newl...." for the content field title


Summary

  • Content objects have dynamic fields defined in the Plate dashboard.
  • These fields are returned under the content key in the response.
  • When creating or updating content objects, field data can be submitted inline.
  • The structure and format of each field depend on its type (string, reference, array, etc.).

Copyright © 2025