Hi,
I am creating a new Confluence Page in Python using REST API.
The code looks something like this:
url = "https://newconfluence.company.org/rest/api/content"
data = {"type":"page", "ancestors":[{"type":"display", "id":2687111}], "title":"Test", "space":{"key":"WE"},"body":{"storage":{"value":source,"representation":
"storage"}}}
headers = {'Content-Type':'application/json'}
r = requests.post(url, data=json.dumps(data), headers=headers, auth=('user', 'password'))
where "source" is a file with the html code.
I tried different html code in source file to make Jira tickets look nicer in the new created Confluence page, but some things are not loading properly.
Below are some examples of html code for Jira ticket:
Example 1 (in this case I get only the text inside <p> in Confluence, but the Jira link doesn't appear)
<p>
https://newjira.company.org/browse/WEL-17779
</p>
Example 2 (for this case, I took with copy+paste the html code generated by Confluence when the same thing is created manually. Again the link to Jira is not visible in Confluence)
<div class="content-wrapper">
<p>
<span class="jira-issue conf-macro output-block" data-client-id="SINGLE_9e98b881-494d-3ae4-bac8-efcab923ca19_28770699_8a79831767658b27016813d1d7ed0006" data-hasbody="false" data-jira-key= " WEL-17779" data-macro-name="jira">
<a href="https://newjira.company.org/browse/WEL-17779" class="jira-issue-key"><span class="aui-icon aui-icon-wait issue-placeholder"> </span>WEL-17779</a>
-
<span class="summary">Getting issue details...</span>
<span class="aui-lozenge aui-lozenge-subtle aui-lozenge-default issue-placeholder">STATUS</span>
</span>
</p>
</div>
This is how Jira ticket looks in Confluence for Example 2(link with Jira is not done)
when it should look like this:
Is there a way to make the link between Jira and Confluence using REST API?
Can someone please help me with this?
Thanks in advance!
I found the answer. So I need to have "Jira Issue/Filter" Macro imported.
Below is the html code used:
<ac:structured-macro ac:name='jira'>
<ac:parameter ac:name='columns'>key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution</ac:parameter>
<ac:parameter ac:name='key'>WEL-17779</ac:parameter> </ac:structured-macro>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.