how to insert jira macro in confluence page with python script?

AnnieLiu February 26, 2024

<ac:structured-macro ac:name='jira'> 

I used above  jira macro in confluence page before, but now we upgraded to cloud confluence/jira and the jira macro became legacy. Now I want to use jira issues as below in python, but I don't know how to use.

jira.PNGWhere can I get the instruction?

1 answer

0 votes
Andrii Maliuta
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2024

Hello @AnnieLiu ,

You can always check the code format of any macro on the page - just add the necessary macro with data and check the ... -> Advanced Details -> View Storage Format.

Looks like it is added as just HTML <a> element with necessary attributes:

<a href="https://x.atlassian.net/issues/?jql=YOUR_JQL_HERE" 
data-card-appearance="block"
data-datasource="{&quot;id&quot;:&quot;aaaa-dfda-4500-baaa-e49addddd4dd&quot;,&quot;parameters&quot;:{&quot;cloudId&quot;:&quot;abc-e1fc-&quot;,&quot;jql&quot;:&quot;project in (\&quot;XXX\&quot;) ORDER BY created DESC&quot;},&quot;views&quot;:[{&quot;type&quot;:&quot;table&quot;,&quot;properties&quot;:{&quot;columns&quot;:[{&quot;key&quot;:&quot;issuetype&quot;},{&quot;key&quot;:&quot;key&quot;},{&quot;key&quot;:&quot;summary&quot;},{&quot;key&quot;:&quot;assignee&quot;},{&quot;key&quot;:&quot;priority&quot;},{&quot;key&quot;:&quot;status&quot;},{&quot;key&quot;:&quot;updated&quot;}]}}]}">
https://x.atlassian.net/issues/?jql=JQL_HERE
</a>

 

AnnieLiu February 27, 2024

Hi, Andrii Maliuta

Thanks for your reply.

But sorry I couldn't find 'view storage format' on my confulence page.

storage.PNG

So I want to know how should I rewrite my 'data-datasource'.  

Like Andrii Maliuta likes this
AnnieLiu February 27, 2024

datasource.PNG

Andrii Maliuta
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 1, 2024

@AnnieLiu ,

Sorry, did not clarify that for Storage Format you need Admin access to the Confluence instance. 

You can also check the page body representation using REST API (https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content/#api-group-content) with the format of:

https://{YOUR_SITE}.atlassian.net/wiki/rest/api/content/{PAGE_ID}?expand=body.storage

 

Suggest an answer

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

Atlassian Community Events