Attempting to create/update confluence property from a Built in Macro:
Reading(GET) of parameter works fine, but PUT/POST fails w:
Fail: {"statusCode":500,"message":"","reason":"Internal Server Error"}During debugging the property was created using the REST API Browser, the parameter was also successfully modified using a modified response from a request.
The example from REST API manual was used:https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/#content/{id}/property-create
{ "key": "example-property-key", "value": { "anything": "goes" } }When attempting same from macro it fails (GET successful)
AJS.$(document).on('click', '#button_$paramChartID', function() {
jQuery.ajax({
contentType: 'application/json',
type: 'GET',
url: confbase + "/rest/api/content/" + AJS.params.contentId + "/property/example-property-key",
}).done(function(response) {
AJS.log("Response: " + JSON.stringify(response));
AJS.log("Response.key: " + response.key);
response.value.anything = "goes" + response.version.number;
response.version.number = response.version.number + 1;
jQuery.ajax({
contentType: 'application/json',
type: 'PUT',
data: response,
url: confbase + "/rest/api/content/" + AJS.params.contentId + "/property/example-property-key",
}).done(function(response2) {
AJS.log("Response: " + JSON.stringify(response2));
AJS.log("Response.key: " + response2.key);
}).fail(function (xhr) {
AJS.log("Fail: " + xhr.responseText);
});
}).fail(function (xhr) {
AJS.log("Fail: " + xhr.responseText);
});
});
Similar problems encountered using jQuery PU and POST before (unresolved/no response)
https://community.atlassian.com/t5/Jira-questions/Failing-with-jQuery-PUT-and-POST-to-JIRA-REST-API-from/qaq-p/1204907
Confluence server 6.15, JIRA Server 8.3