How can I add a hyperlink to a Jira issue in Confluence page using python
Asked by Manuel Ballester Forner:

Hello, I have been using python to extract the URL links of some issues in a Jira project and after I tried to paste those URL links in the Confluence page. I managed to write them in the page but there is no hyperlink that directly directs you to the Jira issue, they are just wrote as a normal URL so you have to copy and paste them instead. Nevertheless, if I edit the page and I copy and paste all the page content as plain text, the links are now working.

After using the code I have something similar to this:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/156540iE5B8E1BBB966267F/image-size/large?v=v2&px=999 "image.png")

And I would like to get this:

![image.png](/t5/image/serverpage/image-id/156530iF3CB0966C34D6FED/image-size/large?v=v2&px=999 "image.png")

In the python script I am creating a string variable ("saved_links") which contains all the URL links and later, in order to create the Confluence page I am using this commands:

![image.png](/t5/image/serverpage/image-id/156533i66368FCFEE422FEC/image-size/large?v=v2&px=999 "image.png")

I would be very grateful if anyone can help me with this.

Thanks


Answers:
author: Dominic Lagger
body: Hi [@Manuel Ballester Forner](/t5/user/viewprofilepage/user-id/4520847)

I do not have Jira linked in my confluence cloud, but it should be the same for confluence internal links.

When you paste the jira link in confluence, then this "button" appears. Then you can check the "[storage format](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html)". This looks like this:

```
<p><ac:link ac:card-appearance="inline"><ri:page ri:content-title="TITLE" ri:version-at-save="3" /><ac:link-body>Labels</ac:link-body></ac:link> </p>
```

You can use this in your body, then the page should be interpreted correctly.

Hope this helps.

Regards, Dominic

comments: author: Manuel Ballester Forner
body: Hello [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600)

I cannot see the storage format because probably I do not have permissions for it, is there any other way to do it?

When you refer to "use it in my body" you mean putting this part in the body of the page while editing? I tried this and still not working...

Thanks in advance,

Manuel


author: Dominic Lagger
body: Hey Manuel

Yes, if you do not see the storage format, then you do not have permissions.

Here is a example of the jira macro from confluence server:

```
<ac:structured-macro ac:name="jira" ac:schema-version="1" ac:macro-id="9ebd88e7-0ea1-4490-9562-62bbea256e29"><ac:parameter ac:name="server">Jira</ac:parameter>
<ac:parameter ac:name="columnIds">issuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution</ac:parameter>
<ac:parameter ac:name="columns">key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution</ac:parameter>
<ac:parameter ac:name="serverId">ff94f833-c264-3d1f-a236-7bdb5d13106c</ac:parameter>
<ac:parameter ac:name="key">JIRA-KEY</ac:parameter></ac:structured-macro>
```

Put this with your "JIRA-KEY" in your user macro and try it out.

Regards, Dominic


Tags: cloud

confluence-cloud