Reputation: 25312
My application should execute some logic each time new issue is added to Jira. I guess the only option for me is to request last added issues every n seconds and find out which issues are new. I am investigating Jira REST API but can't find there any method for retrieving last issues. Is it possible?
Upvotes: 4
Views: 6016
Reputation: 649
you could try consuming the activity feed from Jira. This page outlines the url to access it and to filter it to match your search criteria https://developer.atlassian.com/server/framework/atlassian-sdk/consuming-an-activity-streams-feed/
Upvotes: 3
Reputation: 109
For your polling based solution, you can query the "Search" method in Jira REST API with JQL.
POST to:
http://[yourjirainstance]/rest/api/2/search
With sdata query in body:
{"jql" : "project = MyProject and updated>=2012-09-01",
"startAt" : 0,
"maxResults" : 50
}
This way you can do queries that you would normally do on the Jira interface. Check this for reference of fiels you can use in queries.
Needless to say but don't forget "Content-Type: application/json" in the headers and workout authentication if the session is not already authenticated.
Upvotes: 4
Reputation: 17846
I had to do something similar, eventually I used the Jira Scripting Suite since it was easier. I've added a Jython post function to "Create issue" transition.
This way, any time a new issue will be added, your script will run. Does it answer your needs?
Upvotes: 2