Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Overview

REST API Access

Common

The following code examples are written in C#.

Authentication

The authentication is based on Jira's REST API authentication, so you can use  HTTP basic authentication using your user credentials. 

Code Block
languagec#
// initialize a HttpClient with the Jira base url, e.g. "https://my.atlassian.net/jira"
using HttpClient client = new() {  BaseAddress = new Uri(Config.JiraBaseUrl) };

// authentication can be done by either using a Jira PAT + Bearer or Jira username with password + Basic authentication header 
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Config.JiraPAT);
client.DefaultRequestHeaders.Authorization =new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes(String.Format("{0}:{1}", Config.JiraUserName, Config.JiraPassword))));

Environments

Types

Items