How to get confluence page attachments as BLOB

Hi all,

I am running into an issue of getting downloading attachments that were attached to the confluence page. I need to download as a BLOB but using AP.request is making it difficult in doing so. We are making a call to download/attachments/{id}/{filename}. We get a response with xhr and png binary data in the body.

I’m sure others are having issues with downloading files while using the AP.request so I’m wondering how should I proceed? We also tried passing the png binary data into new Blob with the type 'application/octet-stream" to no avail.

Thanks for any help!

1 Like

i have a such issue, but for now i can download files with a get request such this

@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
...
...
...
Response.ResponseBuilder response = Response.ok(file);
        response.header("Content-Disposition", "attachment;filename=filename.log");
        return response.build();

Javascript

window.open(restUrl);

You are not blocked trying to get images from Atlassian?

We are forced to make the request through AP because if we make our own, we will get blocked by CORS. Since we are going from the iframe on our site to the cloud site, we get blocked unless using AP.request