This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Search in JIRA

The following operation is available for working with search.Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with search, see Sample configuration .

OperationDescription
searchJiraSearch in JIRA using JQL.

Following is more information about these operations.

Searching for issues

To get an existing issue, use searchJira and specify theJQL query.

searchJira
<jira.searchJira>
	<query>{$ctx:query}</query>
	<maxResults>{$ctx:maxResults}</maxResults>
	<startAt>{$ctx:startAt}</startAt>
	<fields>{$ctx:fields}</fields>
	<validateQuery>{$ctx:validateQuery}</validateQuery>
	<expand>{$ctx:expand}</expand>
</jira.searchJira>
Properties
  • query: The JQL expression to use for finding issues. The query must include an ORDER BY clause. For more information, see Advanced Searching in the JIRA documentation.
  • maxResults: Optional. The maximum number of issues to return, up to 1000 (default is 50).
  • startAt : Optional. The 0-based index of the first issue to return (default is 0).
  • fields : Specifies a comma-separated list of fields to be included in the response.
  • validateQuery : Specify whether to validate the JQL query.
  • expand : A comma-separated list of the parameters to expand.
Sample request

Following is a sample REST/JSON request that can be handled by the searchJira operation.

Sample request for searchJira
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "query":"text~\"issue2\""
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e4074

Sample Configuration

Following is a sample proxy service that illustrates how to connect to Jira with the init operation and use the searchJira operation. The sample request for this proxy can be found in searchJira sample request.You can use this sample as a template for using other operations in this category.

Sample proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="searchJira"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <property name="username" expression="json-eval($.username)"/>
         <property name="password" expression="json-eval($.password)"/>
         <property name="uri" expression="json-eval($.uri)"/>
         <property name="query" expression="json-eval($.query)"/>
         <property name="maxResults" expression="json-eval($.maxResults)"/>
         <property name="startAt" expression="json-eval($.startAt)"/>
         <property name="fields" expression="json-eval($.fields)"/>
         <property name="validateQuery" expression="json-eval($.validateQuery)"/>
         <property name="expand" expression="json-eval($.expand)"/>
         <jira.init>
            <username>{$ctx:username}</username>
            <password>{$ctx:password}</password>
            <uri>{$ctx:uri}</uri>
         </jira.init>
         <jira.searchJira>
            <query>{$ctx:query}</query>
            <maxResults>{$ctx:maxResults}</maxResults>
            <startAt>{$ctx:startAt}</startAt>
            <fields>{$ctx:fields}</fields>
            <validateQuery>{$ctx:validateQuery}</validateQuery>
            <expand>{$ctx:expand}</expand>
         </jira.searchJira>
         <log level="full"/>
         <respond/>
      </inSequence>
      <outSequence/>
      <faultSequence/>
   </target>
</proxy>