Expand my Community achievements bar.

SOLVED

How to to add a metadata subnode to jcr:content/metadata to files using AEM API from Fusion

Avatar

Level 2

For metadata organizational purposes, I am trying to add subnodes to jcr:content/metadata/ using the AEM Custom API Call module in Workfront Fusion.  I am trying to do this after loading a new asset to AEM using Workfront Fusion.

 

For example, I'd like to add 

  • jcr:content/metadata/subnode1/subfield1
  • jcr:content/metadata/subnode1/subfield2
  • jcr:content/metadata/subnode2/subfield1
  • jcr:content/metadata/subnode2/subfield2

 

I can add/update existing fields that live in /metadata just fine.  It's when I am trying to add/update a subnode to /metadata where I have an issue since subnode1 and subnode2 do not yet exist (they are not automatically being added in AEM and hence do not appear through CRXDE Lite), i get a 403 error when trying to execute:

{
	"class":"asset",
	"properties":{
		"metadata":{
			"subnode1":{
				"subfield1":"test",
				"subfield2":"test"
			}
		}
	}
}

 

Here is the complete input bundle: 

[
    {
        "url": "api/assets/folder1/folder2/folder3/filename.pdf",
        "body": "{\"class\":\"asset\",\"properties\":{\"metadata\":{\"subnode1\":{\"subfield1\":\"test\",\"subfield2\":\"test\"}}}}",
        "method": "PUT",
        "headers": [
            {
                "key": "Content-Type",
                "value": "application/json"
            }
        ]
    }
]

 

Is there a way I can dynamically add subnode1 to jcr:content/metadata through the AEM API and Fusion?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@bfamous ,

In this case, I would check the user credentials you are passing while trying to add these nodes under the ASSET metadata folder. Also, make sure the user credentials you are using to add these sub-nodes has write access under /content/dam/ node hierarchy.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

@bfamous ,

In this case, I would check the user credentials you are passing while trying to add these nodes under the ASSET metadata folder. Also, make sure the user credentials you are using to add these sub-nodes has write access under /content/dam/ node hierarchy.

Avatar

Level 3

HI, sorry I can't help with your problem but can you show me what the JSON body looks like for updating the existing fields that live in /metadata? I am trying to do this and struggling to get it to work. Any hints would be helpful. Thanks