Set up Issue link (Confluence page type) by Java API

hongchao song January 14, 2018

 

Hi guys,

We intend to set up a issue link to confluence page by Java API, as following:

微信图片_20180114211227.png


And we find some Java APIs available for JIRA Issue but not for Confluence page, such as:

IssueLinkManager,IssueLink.

Could somebody please help us, give us some help?

Thanks in advance.

3 answers

1 vote
Alex Medved _ConfiForms_
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 11, 2019

For ConfiForms you need to setup another IFTTT to call the Jira REST API to setup such link (can user applink service or web service connection types of IFTTTs) - see complete example on how to create a remote link to Jira with ConfiForms on our wiki

 

(Sorry, should have answered this under the @Parvaneh Zand question)

Maxim Grouchevoi March 13, 2019

Hi, Alex.

Your example works fine. But I have an issue with the link type. Currently the link type is "remotelink" but NOT Wiki Page link. How can I change the type?

Unfortunately the Structure Addon doesn't recognize remote links to Confluence and demands a Wiki Page link type. Thanks!

linktype.png

Alex Medved _ConfiForms_
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 13, 2019

I think, it is a matter of setting up a proper application type in JSON, see https://developer.atlassian.com/server/jira/platform/using-fields-in-remote-issue-links/

1 vote
Parvaneh Zand
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 10, 2019

I have the same problem. I'm using ConfiForms IFTTT Integration Rules to create Jira Issue, and I want to link that issue to another Confluence page.

Michael Küng December 13, 2019

Same problem for me, I use two IFTTT. The first is creating the Jira Task and the second should add a confluence page.

Don't get it running.... :(

1. IFTTT

{ "fields": { "project": { "key": "[entry.jiraprojekt]" }, "summary": "[entry.titel]", "description": "[entry.fehlerbild.escapeJSON]", "issuetype": { "name": "Bug" }, "reporter": { "name": "[entry.autor]" } } }

 2. IFTTT

{ "update": { "application": { "type": "com.atlassian.confluence", "name": "Welcome" }, "relationship": "Wiki Page", "object": { "url": "LINK TO PAGE", "title": "Wiki Page", "icon": {}, "status": { "icon": {} } } } }

 

Maybe can figure out the problem? I have search through the whole internet and I don't get it. :D

I want prefer a final code :D

Alex Medved _ConfiForms_
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.
December 13, 2019

Because it is done differently according to Jira REST APIs - that is why it doe snot work for you with those "updates"

 

See the page I am referencing in my answer - it has a complete code

<ac:structured-macro ac:macro-id="d4d6ee84-0f33-4713-b0c4-04baad175345" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">WebService Request</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">/rest/api/latest/issue/[entry.jk.asJSON.key]/remotelink</ac:parameter>
<ac:parameter ac:name="additionalContext">file</ac:parameter>
<ac:parameter ac:name="extras2">X-Atlassian-Token: no-check;</ac:parameter>
<ac:parameter ac:name="who">POST</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="56a89f71-7d60-496a-ab45-2d6f6db4bd34" ac:name="noformat" ac:schema-version="1">
<ac:plain-text-body><![CDATA[{
"object": {
"url":"https://wiki.vertuna.com/pages/viewpage.action?pageId=[entry._page.id]",
"title":"[entry._page.title.escapeJSON]"
}
}]]></ac:plain-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>

Contents you need to POST and the API endpoint you need to use

Like Michael Küng likes this
Michael Küng December 16, 2019

Thanks @Alex Medved _ConfiForms_ !

I will try it, unfortuately I'm just an "user" and our IT have blocked the webservice requests. But I will get further with your helpful comment.

Alex Medved _ConfiForms_
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.
December 16, 2019

Does not have to be a web service request!

You can do the same through the "AppLink Service" IFTTT action!

(Assuming you have connected your Jira to Confluence through the app links) 

Like Michael Küng likes this
Michael Küng December 16, 2019

OMG! It works, thank you some much!

I had to change the Service from "/rest/api/latest/issue/[entry.jk.asJSON.key]/remotelink"

to "/rest/api/latest/issue/[entry.jk]/remotelink", than it was working, before the entry was not working and I got the following message back 

java.lang.IllegalArgumentException: Refusing to sign non-normalized URL: http://home/jira/rest/api/latest/issue//remotelink

Thanks Alex, great support!

0 votes
Alexey Matveev
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 14, 2018

Suggest an answer

Log in or Sign up to answer