Using REST API calls to place image attachments from Jira issue to Confluence page

IL
Contributor
November 13, 2024

Apologies if some version of this has been asked before, I couldn't find it.

 

I want to establish an automation that gathers up all the image attachments on a Jira ticket and places them in a linked Confluence page (say at the end of it). I'm reading the really nice tutorial 

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

and I think I have the hang of the general approach. But I have a couple clarifying questions about the first part, adding attachments to the content (page).

1. What's the appropriate analogue to the F=@FILE-PATH parameter if I'm using, say, the requests module in Python to make the http request? Do I put it in as a data=payload parameter in the requests.request query, and what's the syntax?

(I guess this is more of a general http question than an atlassian question, but I might as well ask it in case anyone has done this before. The REST API documentation for Confluence Cloud seems to have some incomplete examples for the put and post attachment calls for non curl/Java stuff.)

 

2. Is it necessary to first download the attachment locally and then make a PUT request with the binary content, or is it possible to reference a Jira attachments URL in the PUT request in one go? Basically I'm asking about the scope of the F=@FILE-PATH parameter for the Confluence Cloud REST API--- must it always be a local file path or can it be a URL to a content endpoint?

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events