Currently, if I update metadata that already exists in the standard path /jcr:content/metadata, everything works correctly with this payload:
{ "class": "asset", "properties": { "metadata": { "pruebanumber": 22, "singleline": "Value from API" } } }
The problem occurs when I try to update metadata that belongs to a child node named default, whose path would be:
/jcr:content/metadata/default/myField
If that node does not already exist in the asset, the API returns a 403 Forbidden error.
Example of the payload that fails when the default node does not yet exist:
{ "class": "asset", "properties": { "metadata": { "pruebanumber": 22, "pruebasingleline": "Value from API", "default": { "indefault": 1234 } } } }
If I manually create the node or update a field from the asset's Properties in the UI, the default node appears. Then, I can update it via the API without any problems.
I was able to create nodes using a different path (example with x-www-form-urlencoded😞
POST /content/dam/.../image.png/jcr:content default@TypeHint=nt:unstructured default/myField=...
However, I would like to know if there is a way to update the metadata without the need to create this node first, so that the node is created and updated automatically. After creating the node, updating it this way works because the node already exists.
Is there an official, supported way in AEM as a Cloud Service to update a metadata property whose parent node (e.g., /metadata/default) doesn't exist yet, and have the API automatically create the missing structure?
Or, in AEM Cloud, is it mandatory that:
The node must exist beforehand,
Or it must be defined in the Metadata Schema,
Or it must be created manually before calling the API.
Essentially, I want to know if the AEM Assets API can create missing nodes within the metadata during a PUT operation, or if I must necessarily ensure that the node exists (via Metadata Schema or some prior process).
Views
Replies
Total Likes
Hi @EstebanTr ,
In AEM as a Cloud Service, the Assets API cannot create missing metadata nodes.
If the parent node (like /jcr:content/metadata/default) does not exist, the API will return 403 Forbidden and will NOT create it.
To update metadata inside that node, you must first make sure the node exists.
There are only two supported ways:
Supported Ways
Not Possible
The Assets API cannot auto-create /metadata/default or other missing nodes during a PUT request.
You must create the node first. AEM will not create it automatically.
Thanks
Vishal
This behavior is expected in AEM as a Cloud Service. When you update metadata through the UI, AEM automatically creates the required node structure (like /metadata/default) because the UI respects the metadata schema and ensures compliance with the repository model. Once that node exists, the Assets API can update it without issue because the hierarchy is valid.
AEM Cloud enforces stricter repository integrity compared to on-prem. It expects the node hierarchy to exist before you update properties.
Views
Replies
Total Likes
Views
Likes
Replies