Skip to content

C# client library for Jira REST API operations with comprehensive ADF format support

amd-byaran/JiraAPI

Repository files navigation

JiraAPI - C# Jira REST API Client

A comprehensive C# client library for Jira REST API operations with full support for ADF (Atlassian Document Format), issue management, epic creation, and field operations. Converted from Python implementation with enhanced features and reliability.

Features

  • Authentication: Basic authentication support
  • Issue Management: Create, update, and find Jira issues
  • Epic Management: Create and manage epics
  • Story Management: Create and link stories
  • Project Management: Version and component management
  • Mock Mode: Test functionality without making actual API calls
  • Async Support: All API calls are asynchronous

Usage

using JiraAPI;

// Create Jira API client
var jiraApi = new JiraApi(
    serverUrl: "https://your-jira-instance.atlassian.net",
    user: "your-username", 
    password: "your-api-token",
    mockingModeEnable: false
);

// Setup project
await jiraApi.SetupProjectAsync("YOUR_PROJECT_KEY");

// Find a ticket
var tickets = await jiraApi.FindTicketAsync("PROJECT", "Issue Summary");

// Create a new issue
var payload = await jiraApi.CreatePayloadAsync(
    projectKey: "PROJECT",
    epicLink: "PROJECT-100",
    summary: "New Issue",
    description: "Issue Description",
    issueType: "Bug"
);

var result = await jiraApi.CreateOrUpdateTicketAsync(payload);

Building

Using Visual Studio 2026

  1. Open JiraAPI.sln in Visual Studio
  2. Build the solution (Ctrl+Shift+B)

Using Command Line (.NET CLI)

  1. Navigate to the project directory
  2. Run: dotnet build
  3. To run: dotnet run

Using MSBuild

  1. Navigate to the project directory
  2. Run: msbuild JiraAPI.csproj

Configuration

The library requires:

  • .NET 8.0 or later
  • System.Text.Json package (automatically restored)

API Methods

Core Methods

  • Login() - Authenticate with Jira
  • SetupProjectAsync() - Initialize project data
  • FindTicketAsync() - Search for issues
  • FindEpicAsync() - Find epic issues
  • CreateOrUpdateTicketAsync() - Create or update issues

Management Methods

  • GetOrCreateEpicAsync() - Get or create epic
  • GetOrCreateStoryAsync() - Get or create story
  • LinkTicketToStoryAsync() - Link issues
  • SetBlockingIssueAsync() - Set blocking relationships
  • UpdateMilestoneAsync() - Update fix versions

Utility Methods

  • GetAllFieldsAsync() - Get available fields
  • FindCustomFieldIdAsync() - Find custom field IDs
  • GetVersionIdsAsync() - Get project versions
  • AddWatchersAsync() - Add watchers to issues

Mock Mode

Enable mock mode for testing without making actual API calls:

var jiraApi = new JiraApi(mockingModeEnable: true);

Error Handling

The library uses proper exception handling and provides detailed error messages for debugging.

Dependencies

  • System.Text.Json (for JSON serialization)
  • System.Net.Http (for HTTP requests)
  • .NET 8.0 Base Class Library

Notes

This C# version maintains the same functionality as the original Python implementation while following C# conventions and best practices.

About

C# client library for Jira REST API operations with comprehensive ADF format support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published