Forums

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

Rest API raise event "Issue Updated"

Deleted user October 12, 2020

Is it possible in the REST API to trigger an event?

I need to raise event "Issue Updated" via REST API without any changes.

I'm working with plugin "Big Picture", and after adding issue link - Big picture do not capture this change. But if I do something after with this task (change description, or something else) - event has been raised, and big picture creates issue link in Gannt diagram.

2 answers

1 accepted

0 votes
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2020

Hello @[deleted] ,

Welcome to the Atlassian Community!

Currently there is no way to trigger an event via REST API and, anyway, doing this might have undesired side-effects since an issue updated event may trigger email notifications and/or other actions in your Jira instance.

However, reading what you are trying to achieve, I would say this is something you should bring to the attention of the app vendor since:

  1. According to the Types of Synchronization in BigPicture and BigGantt plugins documentation page, the partial sync is triggered by the  issue_createdissue_updated and issue_deleted events.
  2. When an issue is linked, the event fired is actually issuelink_created. This can also be seen in the Jira Webhooks configuration page:

    WebHooks-issue-related-events.jpg

 

 

Please get in touch with the app vendor by using the resources listed in the support tab of the marketplace page for BigPicture:

Contact

 

Also, as a temporary/dirty workaround for your issue, you can create a Jira automation rule (global or project specific) that will actually update the issue (e.g. adding a label, or setting a field) every time an issue is linked.

For details on how to do so, please see: Automate your Jira Cloud processes and workflows

 

I hope this helps.

 

Cheers,
Dario

0 votes
Mateusz Sołowianiuk
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.
November 10, 2020

Hi @[deleted] 

Please excuse me for the untimely response on this matter. 

We verified the behavior internally and, according to our tests, the links appear in the Gantt chart immediately after creating a link in the Jira issue. 

Would you be able to test and confirm if this is true for you as well?

Thank you in advance for letting me know!

Best regards,

Mateusz Sołowianiuk

SoftwarePlant Support

Deleted user November 10, 2020

Hello.

As you can see, when I create issuelink thru REST API , it doesn't create on BigPicture:

1.png

but it creates in issue links:

2.png

Only, when I change description to another value - raise event "issue updated", and after that link creates on big picture:

3.png

There is a VBA code:

Sub test001()
createLink "TESTINVEST-8926", "TESTINVEST-8927"
End Sub

Sub createLink(ByVal sourceKey As String, ByVal targetKey As String, Optional ByVal linkType As String = "Gantt End to Start")
jira.sendRequest "/rest/api/2/issue/" & sourceKey, "PUT", "{""update"":{""issuelinks"":[{""add"":{""type"":{""name"":""" & linkType & """},""outwardIssue"":{""key"":""" & targetKey & """}}}]}}"
'therre is no link on big picture

descr = JsonConverter.ParseJson(jira.getIssues("key=" & sourceKey))("issues")(1)("fields")("description")
jira.updateIssue sourceKey & "", , "link added"
'there is link creates on big picture
jira.updateIssue sourceKey & "", , descr & ""

End Sub

Function sendRequest(address As String, Optional method As String = "GET", Optional requestText As String = "")
TargetURL = getProperty("jira.protocol") & "://" & getProperty("jira.address") & ":" & getProperty("jira.port") & address
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")

myuser = getProperty("jirausername")
mypass = getProperty("jirapassword")
sAuth = main.TextBase64Encode(myuser & ":" & mypass, "us-ascii")

HTTPReq.Open method, TargetURL, False
HTTPReq.setRequestHeader "Content-Type", "application/json"
HTTPReq.setRequestHeader "Authorization", "Basic " & sAuth
HTTPReq.setRequestHeader "x-experience-api-version", "1.0.0"
HTTPReq.send (requestText)
sendRequest = HTTPReq.responseText

End Function

 

Deleted user November 10, 2020

Hello.

As you can see, when I create issuelink thru REST API , it doesn't create on BigPicture:

1.png

but it creates in issue links:

2.png

Only, when I change description to another value - raise event "issue updated", and after that link creates on big picture:

3.png

There is a VBA code:

Sub test001()
createLink "TESTINVEST-8926", "TESTINVEST-8927"
End Sub

Sub createLink(ByVal sourceKey As String, ByVal targetKey As String, Optional ByVal linkType As String = "Gantt End to Start")
jira.sendRequest "/rest/api/2/issue/" & sourceKey, "PUT", "{""update"":{""issuelinks"":[{""add"":{""type"":{""name"":""" & linkType & """},""outwardIssue"":{""key"":""" & targetKey & """}}}]}}"
'therre is no link on big picture

descr = JsonConverter.ParseJson(jira.getIssues("key=" & sourceKey))("issues")(1)("fields")("description")
jira.updateIssue sourceKey & "", , "link added"
'there is link creates on big picture
jira.updateIssue sourceKey & "", , descr & ""

End Sub

Function sendRequest(address As String, Optional method As String = "GET", Optional requestText As String = "")
TargetURL = getProperty("jira.protocol") & "://" & getProperty("jira.address") & ":" & getProperty("jira.port") & address
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")

myuser = getProperty("jirausername")
mypass = getProperty("jirapassword")
sAuth = main.TextBase64Encode(myuser & ":" & mypass, "us-ascii")

HTTPReq.Open method, TargetURL, False
HTTPReq.setRequestHeader "Content-Type", "application/json"
HTTPReq.setRequestHeader "Authorization", "Basic " & sAuth
HTTPReq.setRequestHeader "x-experience-api-version", "1.0.0"
HTTPReq.send (requestText)
sendRequest = HTTPReq.responseText

End Function
Mateusz Sołowianiuk
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.
November 11, 2020

@[deleted] 

Thank you for providing this - I understood you incorrectly and was verifying a different scenario. I am verifying this with our developers again for full confirmation. I will post it in this thread once I have more details. 

Best regards,

Mateusz Sołowianiuk

Like Dario B likes this
Mateusz Sołowianiuk
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.
November 18, 2020

@[deleted] 

Thank you for your patience regarding this. 

Please be informed that our developers managed to create a link in Jira using the POST HTTP method. The link appeared in the Gantt chart instantly after refreshing the page. This is the code that was used:

POST https://INSTANCE-NAME.atlassian.net/rest/api/2/issueLinkContent-Type: application/json
Authorization: Basic bWFyY2luLmtpdGFAc29mdHdhcmVwbGFudC5j********
{
 "outwardIssue": {
 "key": "SCRUM-1"
 },
 "inwardIssue": {
 "key": "SCRUM-2"
 },
 "type": {
 "name": "Gantt End to Start"
 }
}

Also, our developer found that your code does not meet some of the requirements listed in the documentation. The key differences are:

  • a different HTTP method;
  • a different Endpoint;
  • an additional header 'x-experience-api-version", "1.0.0"'

Please verify if such a command will work for you. 

Last but not least, I suggest that, in case of further questions, this discussion is moved to our Service Desk as it will facilitate including the developers in the discussion in a huge extent. 

I hope that this helps, though :)

Best regards,

Mateusz Sołowianiuk

Like Dario B likes this

Suggest an answer

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

Atlassian Community Events