Add label to content template with REST API

201 views
Skip to first unread message

pa...@k15t.com

unread,
Sep 5, 2016, 1:14:28 AM9/5/16
to Atlassian Connect Dev
Hello Atlassians!

I'm trying to add a label to a content template with the REST API. I've tried to follow the documentation: https://docs.atlassian.com/confluence/REST/latest/#template-updateContentTemplate.
So far I've figured out that templateId and name are required parameters, but I still get a 500 error response: 
  1. "java.lang.IllegalStateException: Cannot call entrySet() on collapsed object, ensure the property was included in the expansions on the original service request"
This also happens if I pass no data other than templateId and name. What is the right way to call this API endpoint?


AP.require('request', function (request) {
request({
url: '/rest/api/template/',
type: 'PUT',
data: JSON.stringify({
templateId: TEMPLATE_ID,
name: 'My Template',
labels: [
{
prefix: 'global',
name: 'label1'
}
]
}),
success: function (response) {
console.log(response);
},
error: function (err) {
console.log(err);
}
});
});


Thanks for your help,

Paul

Peter Brownlow

unread,
Sep 21, 2016, 11:53:05 PM9/21/16
to Atlassian Connect Dev
Hi Paul,

It seems that this piece of reference documentation is inadequate. :(
Also, the API should obviously not throw an exception.
We have created the ticket CRA-1473: could you please add your comments to it, and vote for it?

-Peter 
Reply all
Reply to author
Forward
0 new messages