Create a component content asset

Create a component content asset as a child of the component asset.

The component content asset stores the HTML contents of your page components. The type field must contain the same value as the content_type field in the parent component asset created in the last step.

Command

Use the following command to create a component asset:

POST https://website.matrix.squiz.cloud/__management_api/v1/assets

Payload

Set the following fields as shown on the example component content payload:

{
    "asset": {
        "type": "content_type_wysiwyg",  (1)
        "attributes": {
            "name": "Component Content", (2)
            "html": "<p>This is example content for the example page.</p>"
        }
    },
    "parent": {
        "asset_id": "1823",              (3)
        "link_type": "hidden",
        "value": "div_contents",
        "sort_order": 0,
        "is_dependent": true,
        "is_exclusive": true
    }
}
1 Set the type field to content_type_wysiwyg
2 Add a descriptive name to the name field
3 Set the parent:asset_id to the value of the id field in the response of the component asset created in the previous step.

Response

The API response will contain:

{
    "id": "1824",                     (1)
    "type": "content_type_wysiwyg",   (2)
    "attributes": {
        "name": "Component Content",  (3)
        "html": "<p>This is example content for the example page.</p>",
        "htmltidy_status": "wait",
        "htmltidy_errors": "No error found"
    },
    "status": "under_construction",
    "version": "0.0.1",
    "created": {
        "date_time_unix": 1643868373,
        "user_id": "1227"
    },
    "updated": {
        "date_time_unix": 1643868374,
        "user_id": "1227"
    },
    "published": null,
    "status_changed": {
        "date_time_unix": 1643868373,
        "user_id": "1227"
    },
    "metadata_schemas": [],
    "metadata_values": null,
    "paint_layouts": {
        "asset_level": null,
        "asset_level_override": null,
        "url_based": {},
        "user_defined": {}
    },
    "web_paths": null,
    "urls": []
}
1 The asset ID in the id field
2 The asset type created in the type field
3 The name specified in the payload.