Triggering an event in Jira for an external API to poll

Hi there,
We use Cherwell as our Service Desk, via API one of the ticketing options creates an issue in JIRA that our TD / RnD action. We cannot use webhooks to talk from Jira back to Cherwell due to really tight TPN (Disney) security rules about incoming traffic through the firewall. Previously I was using the emails Jira sent out to be captured by the Cherwell email monitor to update tickets with comments, status etc. This all worked well until the email changed and the comment updates stopped reaching Cherwell.

I have a rest api get built that when I trigger manually it goes out to Jira, finds the linked issue key and returns the comments to the cherwell ticket and the status.

I can setup an automation process to run every 10 mins and poll all the active Jira tickets in Cherwell and then run the API to get any comments and update back in Cherwell… but that is load intensive.

Is there a place in Jira (cloud) that I can use as a check for the API to only look for tickets that have updates and not have to look for every ticket, pull in the comments and only update new ones. I am not sure if there is a flag that Jira may create that I can tell the API to look for to know ticket 1, 4, 7 are updated and grab the comments and not pull back 1, 2, 3, 4, 5, 6, 7 and see what is updated.

I know this is a bit of a bumbling question, but I am a bit stuck with this one.


Can you do an issue search from Cherwell to your Jira Cloud instance? If you can, then use a JQL like updated >= -10m - this will return all issue updated within the last 10 minutes.

Will this work for your scenario?


I set up a ‘one-step’ in Cherwell that I manually just ran which I had the end point set up as


I returned that as JSON and then displayed a popup and can see a blob of text returned so that is a plus.

I am not sure how to put a parameter on that per the updated >= -10 part of that. I’ll do some sniffing around on how to setup the GET results back to Cherwell with a parameter.

Thanks for the pointer thus far.


Regarding this one, since jql is a query parameter, you append it to the URL; here’s a sample /rest/api/3/search?jql=updated>=-10m. Hope this helps.

That looks like it is working in a sense, but it is trawling through our entire cloud instance… yikes.

I need to limit it it to be the reporter as “Cherwell User” to get a nicer subset of what I am seeing now… but I think this is getting close.

Yes, if you are only concerned with issues reported by “Cherwell User” then you can add it to the JQL like this updated>=-10m AND reporter="Cherwell User". Feel free to narrow down your search results by adding more filters.

ah thanks, I was using the custom field number for that one customfield_10068… so I had this in place…

/rest/api/3/search?jql=updated>=-10m&customfield_10068=“Cherwell User”

as the Endpoint… wasn’t really doing much :slight_smile:

The ampersand is the culprit here. In JQL, you use the AND or and keyword to join clauses. The ampersand before your custom field will be treated like a delimiter for query parameters.

Right, sorry I haven’t touched JQL before so flying a little slower than normal :slight_smile:

No worries, @stevenls. Hope you got the expected results :slight_smile:

If you’re sticking with the search solution and using JQL, you can check this documentation about advance searches to help you out (might come in handy).


ok I can display the returned data as a lump, but I will need to extract that into an array.

So what I do is call the webservice which stores the returned text as a variable called ‘result’ (I know creative as).

I can display that.
I update a stored variable called JIRA Results as JSON then turn that into a JSON Array…

I then step through a collection (internal Cherwell function) and pull out the author, date, comment etc and update the comments field.

Now it seems the returned JQL as text can’t be turned into JSON - is that expected?

Do you mean response instead of JQL? If you do, the response of the search REST API should be a valid JSON.

On a side note, feel free to use the search API’s field query parameter to only return your desired fields. As an example you can add it like updated>=-10m AND customfield_10068=“Cherwell User”&updated>=-10m&customfield_10068=“Cherwell User”&fields=comment,reporter,updated.

This is working fine;
/rest/api/3/search?jql=updated>=-10m AND reporter=“Cherwell User”

I just updated a ticket in Cherwell which flowed through to Jira and the header back from the GET contained "“total”:1 which is what I was expecting.

I can’t see in the doco about pulling in certain fields. I was going to try and parse for the Jira issue key, comment, author and created (for the comment), if I only can pull back those fields it would save me doing an array to find the right content in the blob that comes back and returning only the latest comment.

I updated my previous reply as I have missed including the part to chery-pick which fields you want. Pretty much like adding this query parameter with comma-separated values of the fields you want to be returned fields=comment,reporter,updated.

sweet… I will have a crack at this tomorrow… meeting then home for the day.

I really really appreciate the assistance with this one.

1 Like

I think this is pulling in what it needs to, but where does the GET hold those returned fields… I am displaying a popup with the results but it is showing all the comments from the incident. So it knows to pull in the comments from an incident that has been updated in the last 10 minutes, but it pulls in everything. Typing this and looking at the information that does seem to gel as there is nothing to limit it to the last comment only.

I might see if I can turn it into a JSON array after the fact and pull out the last comment, descending to add to the incident.