Create a folder asset

This section shows you how to use the API to create a new folder asset from within your code.

Command

Use the following command to create your folder asset:

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

Payload

Set the following fields as shown on the example standard page payload:

    "asset": {
        "type": "folder",                (1)
        "attributes": {
            "name": "FIRST FOLDER",      (2)
            "short_name": "First folder"
        },
        "published": null,
        "metadata_schemas": [],
        "metadata_values": null,
        "external_id": ""
    },
    "parent": {
        "asset_id": "1",                 (3)
        "link_type": "menu",
        "value": "",
        "sort_order": -1,
        "is_dependent": false,
        "is_exclusive": false
    }
}
1 Set the type to folder.
2 Give the asset a name in the name field.
3 Specify where to place the new field by adding the parent asset ID in the parent:asset_id field.

Response

Newly created assets will have a Matrix status of under_construction

The API response will contain:

{
    "id": "1803",                  (1)
    "type": "folder",              (2)
    "attributes": {
        "name": "FIRST FOLDER",    (3)
        "short_name": "First Folder"
    },
    "status": "under_construction",
    "version": "0.0.1",
    "created": {
        "date_time_unix": 1631508847,
        "user_id": "1227"
    },
    "updated": {
        "date_time_unix": 1631508848,
        "user_id": "1227"
    },
    "published": null,
    "status_changed": {
        "date_time_unix": 1631508847,
        "user_id": "1227"
    },
    "metadata_schemas": [],
    "metadata_values": null,
    "paint_layouts": {
        "asset_level": null,
        "asset_level_override": null,
        "url_based": {},
        "user_defined": {}
    },
    "external_id": ""
}
1 The asset ID in the id field.
2 The asset type created in the type field.
3 The name specified in the payload.