Hallo,
i try to download attachments from the confluence sides. With this REST Api Call (https://developer.atlassian.com/cloud/confluence/rest/api-group-content---attachments/#api-api-content-id-child-attachment-get) I can get all attachments on a side. This works as expected.
When I now try to download a attachment with the provided Link (seeing Answer: https://community.atlassian.com/t5/Confluence-questions/How-to-download-a-file-attached-in-confluence-page/qaq-p/650334) I'll get the following error:
status: 403,
text: '{"error":{"code":"Forbidden","title":"Client not found","href":"https://api.media.atlassian.com#UnauthorizedError"}}', method: 'GET'
I also tried to access the link manually and with wget on Powershell there it works as expected and I get the file.
Node.js Superagent Request with Error:
superagent.get(fileURL).end((err: any, res: any) => {
if (err)
console.log(err);
console.log(res);
});Powershell wget Command without Error:
wget "https://api.media.atlassian.com/file/.../binary?token=...&name=...&max-age=..."
Powershell Result:
StatusCode : 200
StatusDescription : OK
Content : {137, 80, 78, 71...}
RawContent : HTTP/1.1 200 OK
X-B3-Traceid: 2f5a1fff89cb7368
X-B3-Spanid: d7d7fb76b419dbf9
X-B3-Parentspanid: 69d13273d5f83dd5
X-B3-Sampled: 1 X-Dns-Prefetch-Control: off
X-Frame-Options: SAMEORIGIN
X-Downlo...
Headers : {[X-B3-Traceid, 2f5a1fff89cb7368], [X-B3-Spanid, 7d7fb76b419dbf9], X-B3-Parentspanid, 69d13273d5f83dd5], [X-B3-Sampled, 1]...}
RawContentLength : 20967
Thanks for your help,
Gregor Ulbricht