cancel
Showing results for 
Search instead for 
Did you mean: 

add category to node

abadr82
Champ in-the-making
Champ in-the-making

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<>();
categoriesNames.add("ad0d372b-d92b-4db4-a8ff-c837e4412674");
categoriesNames.add("62a15b1b-e47e-42bd-a557-fc8eef65f1ce");

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: {http://www.alfresco.org/model/content/1.0}categories\nTitle: Categories\nDescription: null\nDefault Value: null\nDataType Name: {http://www.alfresco.org/model/dictionary/1.0}category\nContainerClass Name: {http://www.alfresco.org/model/content/1.0}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" : "https://api-explorer.alfresco.com",
"logId" : "86f55e70-0839-4be5-9de1-ccff6f72d7ba"
}
}

Any suggestion please.

1 REPLY 1

douglascrp
World-Class Innovator
World-Class Innovator

What API are you using?

Is this the 3.4 version yet?

Alfresco SDK AND APIs installation files | Alfresco Documentation