How to download attachment from page and read json data

Kato Wildiers December 15, 2023

Hi,

I am working on a confluence macro app where I display data that is inside an attachment. I already have in code a correct download link. When I enter my downloadlink in a browser, the download of the attachment succeeds. 

I am struggling though to download and read the data through forge.

 

const response = await fetch(downloadlink)
.then(response => console.log('status: ' + response.status))
.then(response => response.json())

With this code, i receive a 'status: 403'. Even though in my manifest file, I have the right permissions:
permissions:
scopes:
- read:jira-work
- write:confluence-file
- delete:attachment:confluence
- manage:jira-configuration
- read:attachment:confluence
- read:confluence-content.summary
- read:content-details:confluence
- write:jira-work

content:
scripts:
- unsafe-inline
styles:
- unsafe-inline

external:
fetch:
backend:
- '*.atlassian.com'

I have redeployed and upgraded the installs, yet keep getting the 403 status. Anyone knows what I am missing in order to get the attachment content? 

Thanks in advance,

Kato

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events