Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to make JIRA ticket visible in Confluence with REST API

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)

Jira.PNG

when it should look like this:

image.png

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!

1 answer

1 accepted

0 votes
Answer accepted

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>

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Share your Confluence Cloud experience for a chance to win $500!

Take our 5-minute survey to win a $500 Visa gift card! Are you currently using Confluence Cloud? We want to hear from you! Fill out this quick survey about your Confluence Cloud experience so we ...

320 views 5 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you