Tuesday, February 18, 2014

Upload Pages to Confluence with cURL over webdav.

If you want to interact with Confluence documents programmatically, one way is to use curl to connect the Confluence webdav interface.

To get the URL to the page you want to use, use your browser to navigate to:

You should see a list of Confluence Spaces.  Navigate to your space and page and copy the link to yourpage.txt.

To download the page:
curl --request GET --user username:password "https://yourconfluenceserver/plugins/servlet/confluence/default/Global/YOURSPACE/YOURPAGE/YOURPAGE.txt" > yourpage.txt

To upload the page:
curl --request PUT --data-binary "@YOURPAGE.txt" --user username:password "https://yourconfluenceserver/plugins/servlet/confluence/default/Global/YOURSPACE/YOURPAGE/YOURPAGE.txt" > yourpage.txt

No comments: