Script placing file on Confluence page

Rogier The December 5, 2017

Is there a possibility to automatically place a number of files which are in a specific folder and place/attach them on/to an existing Confluence page?

1 answer

1 accepted

0 votes
Answer accepted
Christian Reichert (resolution)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2017

Hi!

You can write something yourself using the REST API 

curl -v -S -u admin@example.com:password -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

The above is taken from this page containing lots of examples: https://developer.atlassian.com/cloud/confluence/rest-api-examples/

Alternatively you can also use a plugin like Bob Swift's Command Line Interface: https://marketplace.atlassian.com/plugins/org.swift.confluence.cli/server/overview

This would allow you something like: 

 

./confluence-cli  --action addAttachment  --space "zcliattachments"  --title "attachment page"  --content "attachment content"  --name "data.txt"  --comment "attachment comment"

Hope this helps,

Chris

Rogier The December 5, 2017

Thanks Chris, I think with the examples I can get what I want. 

Christian Reichert (resolution)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2017

My pleasure.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events