Create a component asset
Add a component asset as a child of your bodycopy asset.
The content component asset is referred to as a bodycopy_div asset type. |
Command
Use the following command to create a component asset:
POST https://website.matrix.squiz.cloud/__management_api/v1/assets
Payload
Each component asset has a child asset - the component content asset.
The content_type
field on the component asset must match the type
field on the component content asset.
You can choose either a WYSIWYG or Raw HTML type, which will determine the editing experience for the component in the Matrix admin UI.
In the example in this guide, the content_type
and type
fields are both set to content_type_wysiwyg
.
For reference, the raw HTML setting value is content_type_raw_HTML
.
Set the following fields as shown on the example component asset payload:
{
"asset": {
"type": "bodycopy_div", (1)
"attributes": {
"name": "Component", (2)
"description": "",
"attributes": {
"content_type": "content_type_wysiwyg", (3)
"layout_type": "div",
"container_id": "",
"template": "",
"css_class": "",
"dir": "ltr",
"disable_keywords": false,
"use_custom_id": false
},
"template_applied": false,
"comments": "",
"persona_evaluation": "any"
},
"published": null,
"metadata_schemas": [],
"metadata_values": null
},
"parent": {
"asset_id": "1822", (4)
"link_type": "hidden",
"value": "",
"sort_order": -1,
"is_dependent": true,
"is_exclusive": false
}
}
1 | Set the type field to bodycopy_div . |
2 | Add a descriptive name to the name field. |
3 | Set content_type field to content_type_wysiwyg . |
4 | Set the parent:asset_id to the value of the id field in the response of the bodycopy asset created in the previous step. |
Response
The API response will contain:
{
"id": "1823", (1)
"type": "bodycopy_div", (2)
"attributes": {
"name": "Component", (3)
"description": "",
"attributes": {
"content_type": "content_type_wysiwyg",
"layout_type": "div",
"container_id": "",
"template": "",
"css_class": "",
"dir": "ltr",
"disable_keywords": false,
"use_custom_id": false
},
"template_applied": false,
"comments": "",
"persona_evaluation": "any"
},
"status": "under_construction",
"version": "0.0.1",
"created": {
"date_time_unix": 1643765207,
"user_id": "1227"
},
"updated": {
"date_time_unix": 1643765207,
"user_id": "1227"
},
"published": null,
"status_changed": {
"date_time_unix": 1643765207,
"user_id": "1227"
},
"metadata_schemas": [],
"metadata_values": null,
"paint_layouts": {
"asset_level": null,
"asset_level_override": null,
"url_based": {},
"user_defined": {}
},
"web_paths": null
}
1 | The asset ID in the id field. |
2 | The asset type created in the type field. |
3 | The name specified in the payload. |