Trying to update an attachment via the REST API in Confluence cloud. The following code 'should' do the trick, but it doesn't. The result is always 'HTTP Status 403 - Request not in an authorized API scope'. The code is executed in the clients browser and not on the either server.
var formdata = new FormData();
var blob = new Blob([xml], { type: "text/xml"});
formdata.append(document.getElementById("modelname").value, xml);
AP.request({
url: '/rest/api/latest/content/'+location.context.contentId+'/child/attachment',
type: 'POST',
contentType: 'multipart/form-data',
data: {comment: 'Edited', minorEdit: false, file: formdata},
success: function(responseText){
console.info(responseText);
},
error: function(xhr, statusText, errorThrownText) {
console.error('Wrongsie!'+statusText);
}
});My scopes as set in atlassian-connect.json
"scopes": [
"read", "write", "delete"
]What am I doing wrong?