user12601909
user12601909

Reputation:

Search for issues that starts with xxx in Jira

This is my first time working with Jira and their API. My company wants me to fetch all "ASAPSD" issues, but I don't understand how to. The core problem in itself is that I do not understand exactly how Jira works, and how issues are "built" up.

The issue starts with "ASAPSD" followed by some random characters and numbers. For example "ASAPSD-334". How can I, with a GET request, get all issues that start with ASAPSD?

Upvotes: 0

Views: 1551

Answers (1)

CraZ
CraZ

Reputation: 1824

Basic information about Jira and projects

The first part (prefix) is the Project Key representing a project/collection where all similar issues are stored (in this case, ASAPSD may stand for ASAP Service Desk:-). There are certainly more projects in every Jira instance. Some other projects are intended to track different activities.

Searching for the project issues

You can search for any issues using the search function (available also via REST API).

First, log in to the Jira and try to search for the issues manually by yourself - in Issue Navigator (via Issues top menu bar). Here you'll find that you can search all issues via Basic (Project is ASAPSD) or Advanced search (project = ASAPSD). This advanced search is called JQL (Jira Query Language).

You can then use this JQL in your REST API search method: https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/search-search

Example

GET https://jira.yourdomain.com/rest/api/2/search?jql=project%3DASAPSD

Notes
  • The output lists only limited number of issues (usually 50) - to get more issues, you need to increase the limit (maxResults param) or paginate (startAt param) over next results.
  • Using expand and fields params you can alter the output to get more/less information.
  • There two types of Jira instances - on-premise Server/Data Center and Cloud one. REST API and usage might slightly differ.
  • Alternatively, you can get CSV export. When you search for issues in the Issue Navigator, there's an option to export results to CSV. Save this URL and you can request it in your script via GET.

Upvotes: 1

Related Questions