how to get the project specific jira issues using jira rest api in .net?

11,139

JIRA's REST API does not appear to currently support any project-based queries separate from their search API.

You can specify a specific project in the search by using the JQL. Given that you know a project (e.g., "JRA" in "JRA-9"), then you can quickly search through all of its issues:

Working result: https://jira.atlassian.com/rest/api/latest/search?jql=project=JRA

One important note is that the results return actual total versus what is actually returned:

"startAt":0,"maxResults":50,"total":30177

You can add query string variables to the request to get more (or less) results. You can also control the fields related to issues to retrieve as well: https://jira.atlassian.com/rest/api/latest/search?jql=project=JRA&startAt=75&maxResults=75 (slower the more you request, and probably not nice to hit their public servers with big numbers).

You can even POST a JSON object that represents the query (slightly tweaked from the linked search docs):

{"jql":"project = JRA","startAt":75,"maxResults":75,"fields":["id","key"]}

Of interest, and as part of the JQL, you can sort the results by any field. Just add " order by id" to the project name, as-in "jql=JRA+order+by+id" in the querystring or "jql": "project = JRA order by id" in the POSTed JSON body.


Note: Above is the actual answer to the real question. However, the literal question is the cause of the `The remote name could not be resolved: 'kelpie9' error.

Their documentation shows kelpie9 as an example server name that they are testing on internally, running on port 8081. Your computer is not aware of a server/machine named kelpie9, as it does not publicly exist. Replace kelpie9 with whatever your JIRA server's hostname is internally and 8081 with whatever port it is using (or remove it if you do not see one when you view JIRA on your intranet site, which means port 80 for http and port 443 for https). For example, many companies run it a "https://jira/". You would replace the example link with https://jira/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key.

Share:
11,139
user958269
Author by

user958269

Updated on August 03, 2022

Comments

  • user958269
    user958269 over 1 year

    I have a requirement where i need to get all the issues for a particular project in jira so for this i have created a console application which has rest client class using which I make a GET request call and for testing purpose rest api url is

    "https://jira.atlassian.com/rest/api/latest/issue/JRA-9"

    using this url i make a HttpWebRequest and get the response back in json formated string. Now this json string contain all the issue specific information but my actual requrement is to get all the project specific issues.

    I tried to find out if i get any project specifc URL for testing purpose from where i get json reply back and I found http://kelpie9:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key but for this i get the "The remote name could not be resolved: 'kelpie9'" error.

    Could you please help me in this? `