user447607
user447607

Reputation: 5469

How can I upload to Confluence using a unix curl command?

OK, so I know how to upload to SharePoint thanks to this question:

How to send file to Sharepoint from Linux creating non existend directories

Now I am trying to figure out how to do it with Atlassian's Confluence. Any takers?

What I am looking for is a scriptable Unix command.

Upvotes: 0

Views: 2074

Answers (2)

Pavan_Ganjigatti
Pavan_Ganjigatti

Reputation: 1

You can do it by running the below command from UNIX.

curl -u $USER_NAME:$USER_PASSWORD  -X POST -H "X-Atlassian-Token: nocheck" -F "file=@${ATTACHMENT_FILE_NAME}" -F "comment=File attached via REST API" ${CONFLUENCE_BASE_URL}/rest/api/content/${PAGE_ID}/child/attachment 2>/dev/null

More information in this link: https://confluence.atlassian.com/confkb/using-the-confluence-rest-api-to-upload-an-attachment-to-one-or-more-pages-1014274390.html

Upvotes: 0

dvdsmpsn
dvdsmpsn

Reputation: 2869

You question needs improving for a real understanding of what you're trying to achieve. That said, you can for example attach a file to a page within Confluence using curl.

The easy way to use do this would be using Bob Swifts Atlassian/Confluence CLI using the addAttachment command to add an attachment.

The plugin changed to be commercial a while back, but you can download the latest free release here.

Upvotes: 2

Related Questions