Retrieving And Filtering JIRA Issue Views Through Request URL

      When developing a JIRA gadget for the WSO2 Gadget Server i found out that some aspects of the JIRA facilities are not well documented. This post will try to help with one such not-well documented service provided by Atlassian JIRA.
      In my gadget i had to filter the data that i needed according to several parameter that would vary from request to request.I decided to use "searchrequest-xml" that is provided by Atlassian JIRA this can be accessed by a simple URL and can also be filtered using parameters in the URL. This will return a XML containing the data that was requested. How the parameters should be defined to filter the request is not clearly documented. The aim of this post to provide a brief documentation as to how the parameters can be set for the "searchrequest-xml" URL request.

What You Need To Know
    The things given below are not that necessary to understand this post as the purpose of the post is to document the format of the "searchrequest-xml" URL. But if you are trying to use this feature (preferably in a gadget) you probably will have some knowledge of list below 
  1. Google Gadgets and the API 
  2. JavaScript
  3. XML
  4. Atlassian JIRA
Getting Started
    What we are trying to accomplish is to retrieve JIRA issue data to be used in our JIRA gadget.Data can be retrived as a xml using the following URL
   This is retrieves all the data related to the organization. It is better if we can retrieve only the data that we need to get by specifying certain parameters with this URL.Here "SearchXML" can be any name you like.

  • Filtering by project
    • You can filter the XML by giving an project id. For example if we are to retrieve the data that is related to the project with project id "ABC" the URL will be as follows.

  • Restricting the maximum number of items return
    • This can be done by using the parameter "tempMax". the following example will only retrieve the first 10 results of the filter.

  • In the same manner the following parameters can be also used to filter the data.
    • issuetype: eg- issuetype=BUG
    • priority: eg- priority=HIGH
    • resolution: eg-  resolution=Unresolved
    • status: eg- status=Open
    • repoter
    • assignee
  •  Searching 
    • This URL can also be used to search the content of the issues and find the related issues for a search query.below is the format of the search query.
              The above URL searches the XML for the word "build" and it looks in environment, comments and summery. Here the param "query" specifies the string to be searched and you can set where you want to search by setting body=true to search in comments.Likewise you can set environment,summery and description true if you want to search them also.

  • Paging 
    • Parameter can be set to do paging for the request. As shown in the following URL
      Here the link retrieves two items from the XMLand it starts with the second item so this can be used to page the request by generating the request URL correctly

  • Searching by dates
    • The request can be also filtered by related dates.As given by the following URL
        This searches for related issues created after 2010/02/12 and before 2010/12/02.the following formats can be used to specify dates.

    • yyyy/MM/dd HH:mm', 'yyyy-MM-dd HH:mm', 'yyyy/MM/dd', 'yyyy-MM-dd or as DD/MMM/YYYY

     This is only a small amount of parameter that i came across. There are many other below are the

  • assigneeSelect
  • created:after
  • created:before
  • created:next
  • created:previous
  • description
  • duedate:after
  • duedate:before
  • duedate:next
  • duedate:previous
  • pid
  • query
  • refreshFilter
  • reporter
  • Selectreset
  • Update
  • resolutiondate:after
  • resolutiondate:before
  • resolutiondate:next
  • resolutiondate:previous
  • showView 
 Discovering On Your Own
     I have not listed all the options that are available in the post there are many other parameters that can be specified. And it is not that hard to figure out how to specify them and what they do. What i did was use the search options given in the dashboard and specifiy a search critiera the link for the search criteria can be found from the permanent link that is in the top right coner of the page. use a little bit of Firebug and you will be able to figure out what you need in no time
Note: Firebug is a Firefox extension that can be used for many purposes in this context it can be used to view the request and response headers.

Example code 
  Lets look at a small example. The following code snippets are part of a gadget description XML and uses the Google Gadgets JavaScript API. This example will demonstrate how to make a search request to JIRA and how to retrieve data.
function makeXMLRequest(){
var params = {};
var prefs=new gadgets.Prefs();
var url= prefs.getString("feedurl");
      params[] =;
   ,processXML, params);
function processXML(obj) {

      var xmldata =;
          document.getElementById('content_div').innerHTML = obj.text;

    Here the UserPref  "feedurl" holds the request URL that is made according to the format described above 


  1. thank you. but how do you log in?

    1. I am not sure what you mean by log in here. but to access data it is not required to log in for example try this.

      If you want to authenticate the user and retrieve user specific data i think you have to use OAuth. I haven't worked with authentication.

    2. JIRA also supports a REST API and a XML_RPC API as far as i know :). These API's might provide what you are looking for.

  2. If you want to add login details to the url, try adding this:



Post a Comment

Popular posts from this blog

Writing Unit Tests to test JMS Queue listener code with ActiveMQ

Reading and Writing Binary files in java - Converting Endianness ( between Big-endian byte order and Little-endian byte order)

How to set up a Apache Spark cluster in your local machine