Contains utilities for interacting with Atlassian JIRA.
This project is licensed under BSD.
Dependencies & Requirements
- This project began in 2010 during a ShipIt day at Atlassian with a provider to query Jira issues using LINQ syntax. Over time it grew to add many more operations on top of the JIRA SOAP API. Support of REST API was added on v4.0 and support of SOAP API was dropped on v8.0.
- For a description changes, check out the Change History Page.
- VS Jira, a VisualStudio Extension that adds tools to interact with JIRA servers.
A LinqToJIRA provider allows to query a JIRA server using Linq syntax:
// create a connection to JIRA using the Rest client var jira = Jira.CreateRestClient("http://<your_jira_server>", "<user>", "<password>"); // use LINQ syntax to retrieve issues var issues = from i in jira.Issues.Queryable where i.Assignee == "admin" && i.Priority == "Major" orderby i.Created select i;
See the JQL Page for a list of supported fields and operators.
var issue = jira.CreateIssue("My Project"); issue.Type = "Bug"; issue.Priority = "Major"; issue.Summary = "Issue Summary"; await issue.SaveChangesAsync();
var issue = await jira.Issues.GetIssueAsync("TST-5"); issue.Summary = "Updated Summary"; issue.SaveChanges();
Auto fetch field values
var issue = await jira.Issues.GetIssueAsync("TST-5"); Console.WriteLine(issue.Priority.Name); // returns the string of the priority field, for example "Critical" Console.WriteLine(issue.Type.Name); // returns the string of the issue type field, for example "Bug" Console.WriteLine(issue["My CustomField"]); // returns the string of the custom field named "My CustomField"
var issue = (from i in jira.Issues.Queryable where i["My CustomField"] == "Custom Field Value" select i).First(); issue["My CustomField"] = "Updated Field"; // No need to know the id of the custom field. issue.SaveChanges();
var issue = await jira.Issues.GetIssueAsync("TST-5"); // get attachments var attachments = await issue.GetAttachmentsAsync(); Console.WriteLine(attachments.First().FileName); // download an attachment var tempFile = Path.GetTempFileName(); attachments.Download(tempFile); // upload an attachment await issue.AddAttachmentsAsync("fileToAdd.txt");
var issue = await jira.Issues.GetIssueAsync("TST-5"); // get comments var comments = await issue.GetCommentsAsync(); Console.WriteLine(comments.First().Body); // add comment await issue.AddCommentAsync("new comment");
var issue = await jira.Issues.GetIssueAsync("TST-5"); // add a worklog await issue.AddWorklogAsync("1h"); // add worklog with new remaining estimate await issue.AddWorklogAsync("1m", WorklogStrategy.NewRemainingEstimate, "4h"); // retrieve worklogs var worklogs = await issue.GetWorklogsAsync();
var issue = jira.CreateIssue("My Project", "PARENTISSUE-1"); issue.Type = "5"; // the id of the sub-task issue type issue.Summary = "A sub task"; await issue.SaveChangesAsync();
var issue = await jira.Issues.GetIssueAsync("TST-5"); issue.Resolution = "Won't Fix"; await issue.WorkflowTransitionAsync(WorkflowActions.Resolve);
All features tested on JIRA v7.1. If you run into problems using a previous version of JIRA let me know.
Please open an issue if you encounter a bug, have suggestions or feature requests. I'll do my best to address them.
Federico Silva Armas