Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,296,482
Community Members
 
Community Events
165
Community Groups

Add attachment to a Confluence page with Jira cloud post function

Hello All,

I am using jira cloud and scriptrunner for jira cloud and I want to copy the jira issue attachment add that attachment to the confluence page on the post function.

I am able to get the issues attachment and also able to create the new page on the confluence.
But Im not able to add that attachment to the confluence.

How can I do that?

 

Thanks ,

Chinmay

2 answers

Hi,
I'm with Elements, and we just released a new app Elements Publish to Confluence that might meet your needs. The app allows you to create pages from Jira with issue data.

Elements-Publish-to-Confluence-create-from-Jira.png

If you want to learn more, check out this article that explains how to create Confluence pages linked to Jira issues with the app.

Let me know if you have any questions!

Julie :)

 

Hi @Julie d_Antin _Elements_ ,

 

Thanks for your reply. As per your suggestion, I took a trail version of  Elements Publish to Confluence plugin and tested a lot to copy attachments from current issue to confluence. It is creating a page in confluence on workflow post function with all mentioned data EXCEPT attachments. 
I checked that I have enabled attachment option in the content module.

If you solved this, nothing like it for me.

Looking for your response.

 

Regards,

Chinmay

You can add attachment to a confluence page by sending a POST request to the /rest/api/content/<pageID>/child/attachment API method.

Example Curl Command -

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

Please change USER_NAME/USER_PASSWORD/ATTACHMENT_FILE_NAME/CONFLUENCE_BASE_URL/PAGE_ID as necessary in the above command.

 

Hi @Kishan Sharma ,

 

Thanks for the reply.

I am using scritrunner for jira cloud so that I want groovy script to add attachment. curl code will not work in this case.

Can you please suggest any other groovy script to run using scriptrunner ?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

367 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you