Forums

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

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.PNG Where 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

 

Like • kchan_d likes this
kchan_d
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 20, 2025

@Andrii Maliuta sorry for refresh this.

I notice there's hashlike `macro id`.  What's this used for? Will a random generated by myself work?

Thanks for advance :)

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.
January 20, 2025

Hello @kchan_d ,

This hash is generated by Confluence automatically and is unique. As I know you can skip adding the ID (or add any other one) when adding macro with code and after next page update Confluence will add it itself, so it should work fine.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, knowledge sharing, intentional knowledge sharing playbook, loom, confluence, team collaboration, knowledge management, workplace productivity, information silos, documentation best practices, internal communication, knowledge sharing strategies

Conquer collaboration chaos with Loom + Confluence

You don't need more tools. You need tools that actually work together – the way humans do. See how Loom + Confluence help teams collaborate with more context, more connection, and fewer calendar invites. 💪

See inside
AUG Leaders

Atlassian Community Events