Click here to Skip to main content
15,500,921 members
Articles / Programming Languages / C#
Posted 20 Apr 2014

Tagged as


22 bookmarked

Connecting to Jira using C#

Rate me:
Please Sign up or sign in to vote.
4.83/5 (8 votes)
20 Apr 2014CPOL2 min read
This tip explains how to connect to Jira from C#


In my current project, we use Atlassian Jira for issue tracking and also for Agile Project Management. We moved to Jira recently, though Jira provides lot of built-in reports, our requirement forced me to look for ways to connect to Jira to get data. This tip talks about the ways to connect to Jira using Atlassian SDK.

Getting the SDK

Atlassian Jira .NET SDK can be installed using nuget from this link or using the following command in Package Manager Console available in Visual Studio:

Install-Package Atlassian.SDK -Version 2.2.0

Using the Code

The following code shows how to connect to Jira after referencing Atlassian Jira .NET SDK in Visual Studio project.

using Atlassian;

namespace JiraResultsApp
    class Program
        static void Main(string[] args)
            Jira jiraConn = new Jira("", jUserID, jPassword);
            string jqlString = PrepareJqlbyDates("2014-03-01", "2014-03-31");
                jiraIssues = jiraConn.GetIssuesFromJql(jqlString , 999);

            foreach(var issue in jiraIssues)
                 System.Console.WriteLine(issue.Key.Value +" -- "+ issue.summary);

        static string PrepareJqlbyDates(string beginDate, string endDate)
            string jqlString = "project = PRJ AND status = Closed AND 
            resolved >= "+beginDate+" AND resolved <= "+ endDate;
            return jqlString;

Code Explanation

  • Include "using Atlassian"
  • Create Jira connection instance using the following line:
    Jira jiraConn = new Jira("", jUserID, jPassword);
  • This instance is used to retrieve the data from Jira.
  • Though we are creating the Jira Connection here, the actual connection will not happen here. Instead it happens when we try to retrieve data in the following line:
    IEnumerable<Atlassian.Jira.Issue>?<atlassian.jira.issue> jiraIssues = jiraConn.GetIssuesFromJql(jqlString , 999);
  • The method GetIssuesFromJql takes two parameters, first: the JQL String and then the maximum number of issues to return from the search.
  • Instead of JQL, Jira also provides another way to get data using the filters as shown below:
    jiraConn.GetIssuesFromFilter("My Filter"); 
  • Once we get the list of issues, we can iterate through the issues and get each issue details.
  • We also can use GetIssue("IssueID") to get specific issue details.
  • Apart from getting the information, the SDK also provides other methods such as:
    • CreateIssue: Create an issue
    • GetProjects: Get list of projects in the URL

Custom Fields

  • One problem that you notice while accessing fields information is that, not all the fields will be accessible directly. This is because Jira allows us to add custom fields by Project.
  • So, in order to access Custom Fields, we have to use "CustomFields" as shown below:
  • Before accessing any custom field, we should check whether they are null or not.
    string jStoryPoints = issue.CustomFields["Story Points"] != null ? issue.CustomFields["Story Points"].Values[0] : "";
    string jDeveloper = issue.CustomFields["Developer"] != null ? 
        issue.CustomFields["Developer"].Values[0] : "";
    string jTester = issue.CustomFields["Tester"] != null ? issue.CustomFields["Tester"].Values[0] : "";  

Connecting using SOAP Service

  • Apart from connecting using SDK, we can also connect using the Jira SOAP service.
  • This tip explains how to connect using the SOAP service.
  • The methods supported by both SDK and SOAP service are same.

Points of Interest

I learned how to connect to Jira using both SDK and also using SOAP service.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

QuestionError fetching data from Jira Pin
Member 1379557824-Apr-18 1:54
MemberMember 1379557824-Apr-18 1:54 
QuestionSystem.ServiceModel.EndpointNotFoundException was unhandled Pin
Member 1037284723-Feb-18 7:42
MemberMember 1037284723-Feb-18 7:42 
QuestionCreate Issue with custom field Pin
sekharnani4-Feb-18 23:54
Membersekharnani4-Feb-18 23:54 
QuestionCould you please share me the details about how to get list of issues from Jira server Pin
Member 129158679-Jan-17 5:09
MemberMember 129158679-Jan-17 5:09 
Question+1 up Pin
Jaxam22-Jun-16 8:29
MemberJaxam22-Jun-16 8:29 
QuestionConnecting JIRA using C# over https when .p12 certificate is used Pin
Arpit D5-Oct-15 14:04
MemberArpit D5-Oct-15 14:04 
QuestionAccessing Original Estimate Pin
StevenHawkes29-Mar-15 9:52
MemberStevenHawkes29-Mar-15 9:52 
QuestionUrgent Help!!! - Getting error - The remote server returned an unexpected response: (407) Proxy Authorization Required. Pin
Member 1146569319-Feb-15 19:36
MemberMember 1146569319-Feb-15 19:36 
QuestionGetting all issues Pin
inner444429-Dec-14 22:50
Memberinner444429-Dec-14 22:50 
QuestionCan we get more documentation or exmples of how to use the CreateIssue Function Pin
CBSanchez16-Oct-14 8:10
MemberCBSanchez16-Oct-14 8:10 
QuestionThank you! Pin
Member 412224123-Jul-14 8:54
MemberMember 412224123-Jul-14 8:54 
QuestionPerfect work Pin
Member 1092203023-Jul-14 3:17
MemberMember 1092203023-Jul-14 3:17 
GeneralThanks a lot! Pin
K.Meister20-May-14 22:04
MemberK.Meister20-May-14 22:04 
GeneralRe: Thanks a lot! Pin
Ali BaderEddin1-Jul-15 13:47
MemberAli BaderEddin1-Jul-15 13:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.