How to call External (Non-JIRA) API from JIRA?

David K January 3, 2019

Hey guys,


On certain trigger, like adding a new comment in JIRA Issue (Ticket), I would like to call an external API (non JIRA, some third party web app that has exposed API). 

How can I do this with JIRA? Is it possible via Script Runner? If so.. are there any examples?
I only found all examples related to inner JIRA APIs.

Thanks.

David

1 answer

0 votes
josh
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 3, 2019

I don't know what is possible in Script Runner, but I have done this with the built in Webhooks. Not all webhook targets are equipped to directly handle the payload however, and I have had to write intermediate scripts to process Jira's outbound calls and reformat them into the right format for 3rd party remote system.

I host the scripts that do this on the same webserver as Jira's reverse proxy. so the webhook target url is http;//localhost/automation/script1 etc.. but I'd like to eventually move that to some kind of serverless (AWS Lambda maybe).

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2019

It is possible in ScriptRunner, but only because you can use Groovy/Java to build REST calls.  Webhooks are often easier because you don't have to do all the code to generate and issue the calls.

David K January 4, 2019

Yes, but for example, if I need to send newly added JIRA Comment to my Web App. Is it possible via Webhooks? Can you send content via Webhooks (like POST body)?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2019

Yes, a webhook sends content - it pokes data at a url.   That is a very oversimplified way to put it, but I think it helps explain the basic concept of webhooks.

We can't actually tell you a lot more.  We have no information on what the other application's API is, what it is available over or what it expects.

David K January 6, 2019

Hey Nic,

We want to send an update to our SOAR (Security Orchestration and Automation Response) tool whenever new comment is added to a certain JIRA Ticket, we want to update a case in SOAR. But the SOAR does not have any specific listener for such events, so I guess we will have to somehow 'hack' this feature to receive webhooks on SOAR.

 

Best,

David

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 8, 2019

Hmm, it's a bit more difficult if the target system doesn't have a url based external API. 

If it doesn't accept REST/url based calls, then yes, you probably are looking more at using scripts to access it via whatever remote API it does have.  (Webhooks are really just "poke url")

Suggest an answer

Log in or Sign up to answer