Hello,
I’m trying to upload an attachment when editing a macro and I cannot. I’m using the exact piece of code given in documentation(https://developer.atlassian.com/static/connect/docs/latest/javascript/module-request.html), changing the pageId, of course:
// Upload an attachment to a Confluence entity.
var fileToUpload = document.getElementById("fileInput").files[0];
AP.request({
url: '/rest/api/content/123456/child/attachment',
type: 'POST',
contentType: 'multipart/form-data',
data: {comment: 'example comment', file: fileToUpload},
success: function(responseText){
alert(responseText);
}
});
I tried with PUT too.
The only error I have is “Internal server error”, and in the HTML: “If there are no known problems and your page hasn’t appeared again in 5-10 minutes then please create a support request for assistance.” So here I am.
The page already exists, so that should not be the problem.