Skip to main content
Relation fields connect one CMS entry to another entry, or to supported Plato records such as menu products and menu categories.

Write Relation Values

Single relation:
{
  "values": {
    "category": "entry_category_1"
  }
}
Multi relation:
{
  "values": {
    "relatedProducts": ["entry_1", "entry_2"]
  }
}
Plato validates relation ids before saving. If an id does not exist in the API key workspace, the request fails:
{
  "message": "Invalid relation value for field 'category'."
}

Read Relation IDs

If you select a relation field without nested fields, Plato returns the stored id or ids.
?fields=id,name,category
Response:
{
  "id": "entry_123",
  "name": {
    "en": "Classic Burger"
  },
  "category": "entry_category_1"
}

Expand Relations

Use nested selection to expand related CMS entries.
?fields=id,name,category(id,name)
Response:
{
  "id": "entry_123",
  "name": {
    "en": "Classic Burger"
  },
  "category": {
    "id": "entry_category_1",
    "name": {
      "en": "Burgers"
    }
  }
}

Relation Depth

maxDepth controls how far nested relations can expand.
?fields=id,name,category(id,name,parent(id,name))&maxDepth=2
Default depth is 3. Maximum depth is 6. Keep depth low for public pages.

Supported System Relation Targets

CMS relation fields can also target supported Plato records. Currently supported system relation targets include:
  • MenuProduct
  • MenuCategory
When expanded, system records return:
{
  "id": "menu_product_id",
  "name": {
    "en": "Classic Burger"
  }
}