add category to node

Showing results for 
Search instead for 
Did you mean: 
Member II

add category to node

Hi All, 

I tried to add categories to a node that already have the aspect cm:generalclassifiable. Below the code using the SDK

AlfrescoClient client = AlfrescoService.getAlfrescoClient();
NodesAPI nodesAPI = client.getNodesAPI();

ArrayList<Object> categoriesNames = new ArrayList<>();

LinkedTreeMap<String, Object> map = new LinkedTreeMap<String, Object>();
map.put("cm:categories", categoriesNames);

NodeRepresentation categoryNode = nodesAPI.updateNodeCall("0e68a793-dbed-4f7f-bca6-8887aa02d9fa" , new NodeBodyUpdate(map)).execute().body();

I received the following error : 

"error" : {
"errorKey" : "framework.exception.ApiDefault",
"statusCode" : 500,
"briefSummary" : "07210098 Failed to persist collection entry: \n Property: Name: {}categories\nTitle: Categories\nDescription: null\nDefault Value: null\nDataType Name: {}category\nContainerClass Name: {}generalclassifiable\nisMultiValued: true\nisMandatory: false\nisMandatoryEnforced: false\nisProtected: false\nisIndexed: true\nisStoredInIndex: true\nisIndexedAtomically: true\nindexTokenisationMode: FALSE\n\n Index: 0\n Value: ad0d372b-d92b-4db4-a8ff-c837e4412674",
"stackTrace" : "For security reasons the stack trace is no longer displayed, but the property is kept for previous versions",
"descriptionURL" : "",
"logId" : "86f55e70-0839-4be5-9de1-ccff6f72d7ba"

Any suggestion please.

1 Reply
Advanced II

Re: add category to node

What API are you using?

Is this the 3.4 version yet?

Alfresco SDK AND APIs installation files | Alfresco Documentation