View fields available in your environment when creating an Improvement type issue with project name PRJT:
https://xxx.jira.com/rest/api/2/issue/createmeta?projectKeys=PRJT&issuetypeNames=Improvement&expand=projects.issuetypes.fields
Make sure and replace xxx and/or the domain with your JIRA instance. This will show you all fields that can be managed through the web service.
Create asp.net 4.5 Console Application Project in Visual Studio 2012.
Download NuGet Packages:
- Json.NET
- Microsoft ASP.NET Web API 2 Client
- Microsoft HTTP Client Libraries
Here is the C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace ConsoleApplication5
{
public class Issue
{
public Fields fields { get; set; }
public Issue()
{
fields = new Fields();
}
}
public class Fields
{
public Project project { get; set; }
public string summary { get; set; }
public string description { get; set; }
public IssueType issuetype { get; set; }
public Fields()
{
project = new Project();
issuetype = new IssueType();
}
}
public class Project
{
public string key { get; set; }
}
public class IssueType
{
public string name { get; set; }
}
class Program
{
static void Main(string[] args)
{
var data = new Issue();
data.fields.project.key = "PRJT";
data.fields.summary = "test";
data.fields.description = "test";
data.fields.issuetype.name = "Improvement";
string postUrl = "https://xxx.jira.com/rest/api/latest/";
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
client.BaseAddress = new System.Uri(postUrl);
byte[] cred = UTF8Encoding.UTF8.GetBytes("user:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(cred));
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
System.Net.Http.Formatting.MediaTypeFormatter jsonFormatter = new System.Net.Http.Formatting.JsonMediaTypeFormatter();
//System.Net.Http.HttpContent content = new System.Net.Http.ObjectContent<string>(data, jsonFormatter);
System.Net.Http.HttpContent content = new System.Net.Http.ObjectContent<Issue>(data, jsonFormatter);
System.Net.Http.HttpResponseMessage response = client.PostAsync("issue", content).Result;
if (response.IsSuccessStatusCode)
{
string result = response.Content.ReadAsStringAsync().Result;
Console.Write(result);
}
else
{
Console.Write(response.StatusCode.ToString());
Console.ReadLine();
}
}
}
}
This comment has been removed by the author.
ReplyDeleteField Address Verification Solution, Retail/Mass Distribution Solutions, B2B Sales/Direct Sales Solution, SME/MSME sales & Service solutions, Lead & Funnel Management solutions, Sales Force Effectiveness solutions, Telecalling solutions.
ReplyDeleteVisit:-https://www.findfacts.in/
Returns the keys of all properties for the comment identified by the key or by the id. bathroom renovation seattle
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteCreating an issue using the Jira REST API is as simple as making a POST with a JSON document. Learn more about Charlottesville Tree Service
ReplyDeleteCreating an issue using the Jira REST API is as simple as making a POST with a JSON document. Find out more info here
ReplyDeleteSharePoint isn't a replacement for ASP.NET. It's an extension of the ASP.NET platform that simplifies the implementation of several common use cases that are mostly relevant to enterprise websites: document management, knowledge retention, collaboration etc. See more about Harrisonburg Basement Waterproofing .
ReplyDeleteJira APIs can be used to develop any kind of integration, automate Jira interactions, or create apps. Find more at https://www.concreteharrisonburg.com/.
ReplyDeleteGlad to found this useful information. find out more about fencing services here.
ReplyDeleteGreat and informative content. raleigh home inspector
ReplyDeleteGreat and informative blog. composite decking
ReplyDeleteClick us for any type of fencing services in Buffalo, NY.
ReplyDeleteinformative blog. concrete contractor kansas city
ReplyDeleteInteresting article. chain link fencing richmond va
ReplyDeleteThanks a lot for sharing this post, I haven't been able to find a reliable way to post any JIRA issues until now, I'll be sure to keep all this information within reach for when I need it. I would like to recommend the best home remodeling in wheaton
ReplyDeleteI began having the same kind of issue you described here, thankfully I had this article stored and I could resolve it in no time! I would like to recommend my favorite duct cleaning gainesville fl
ReplyDeleteThis is so informative. Thanks for sharing this one! https://truckpartsuperstore.ca/
ReplyDeleteVery much appreciated. Thank you for this excellent article. Keep posting!
ReplyDeleteLandscaping Contractor Medicine Hat
Nice post! Thanks for taking the time in sharing this great article in here.
ReplyDeletePlastic Surgery Sacramento CA
"Thanks for sharing this interesting blog here
ReplyDeleteTree Removal Calgary
'
"Such an awesome post. Thanks for sharing!
ReplyDelete"
https://tallahasseefencing.net
I really enjoy reading your posts. great work!
ReplyDeleteTree Service Clarksville TN