Forums

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

Add attachment to a Confluence page with Jira cloud post function

chinmay konkar July 20, 2021

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

0 votes
Julie d'Antin [Elements]
Atlassian Partner
August 13, 2021

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 :)

 

chinmay konkar September 13, 2021

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

0 votes
Kishan Sharma
Community Champion
July 26, 2021

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.

 

chinmay konkar September 15, 2021

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
Product Admin
TAGS
AUG Leaders

Atlassian Community Events