500 error while adding tags using Rest Api

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
abhi1o3
Member II

500 error while adding tags using Rest Api

Hi

I am hiting below post method to add a tags.

POST/alfresco/service/api/node/{store_type}/{store_id}/{Id}/tags

request body-

["test"]

response-

{
"status": {
"code": 500,
"name": "Internal Error",
"description": "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message": "09300061 Wrapped Exception (with status template): 093065371 Error during processing of the template 'The following has evaluated to null or missing:\n==> tags [in template \"org/alfresco/repository/tagging/node.tags.post.json.ftl\" at line 2, column 16]\n\nTip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??\n\nThe failing instruction:\n==> #list tags as tag [in template \"org/alfresco/repository/tagging/node.tags.post.json.ftl\" at line 2, column 9]'. Please contact your system administrator.",
"exception": "",
"callstack": [],
"server": "Community v5.2.0 (re21f2be5-b22) schema 10,057",
"time": "Oct 30, 2018 3:07:02 PM"
}

please help me to resolve the error.

1 Reply
Moderator
Moderator

Re: 500 error while adding tags using Rest Api

This POST works fine for me using postman. Maybe you are not specifying the content-type header with a value of "application/json"?

If you are specifying the header and it still isn't working, please share your code, or, better yet, a curl command.

For example, this works:

curl -uadmin:admin -XPOST "http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/6ab3e90c-24ef-47cf-abc7-af112e..." -H "content-type: application/json" -d"['test2']"