Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Upload attachment API attaches files to the Attachment tab rather the page

atalwar October 29, 2021

Hi Everyone,

 

 

I'm trying to use the confluence API to upload an attachment. The API works, however, the attachment goes to the attachments page. I would like the attachment to get attached to the page itself.

 

curl -v -S -u admin@example.com:api_token -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" -F "comment=this is my file" "https://your-domain.atlassian.net/wiki/rest/api/content/3604482/child/attachment" | python -mjson.tool

1 answer

1 accepted

0 votes
Answer accepted
Thomas Deiler
Community Champion
October 30, 2021

Dear @atalwar ,

what you observed is "by design". All attachments are stored as 'content' of one page. The overview is the 'tab' you describe.

When you like to make the attachment appear on the page, you need to reference it in the body of your page.

I recommend to get one page with attachments, to have an example how attachments are referenced. Then, after the attachment upload, you can update the page with the REST API to make the attachment visible.

So long

Thomas D

Thomas Deiler
Community Champion
October 30, 2021

I found an excellent article with details about exactly what you like to do.

Suggest an answer

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

Atlassian Community Events