How to edit and delete the JIRA component name by using REST API in a console application (c#)?
Your application should use the Component REST API to update/delete the components.
Hi Nic,
I have following doubts,
PUT /rest/api/2/component/{id}<br>
{id}
I used to add a new component by below coding:
class Program { private const string URL = "https://xyz.atlassian.net/rest/api/2/component"; private const string DATA = @{"name"": ""sample Component"", ""description"": ""This is a JIRA component"", ""leadUserName"": ""Sample manager"", ""assigneeType"": ""PROJECT_LEAD"", ""isAssigneeTypeValid"": false, ""project"": ""TP""}"; static void Main(string[] args) { try { AddComponent(); } catch(Exception ex) { Console.WriteLine(ex); Console.ReadKey(); } Console.WriteLine("Component Added"); Console.ReadLine(); } private static void AddComponent() { try { System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(); client.BaseAddress = new System.Uri(URL); byte[] cred = UTF8Encoding.UTF8.GetBytes("username: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.HttpContent content = new StringContent(DATA, UTF8Encoding.UTF8, "application/json"); HttpResponseMessage messge = client.PostAsync(URL, content).Result; string description = string.Empty; if (messge.IsSuccessStatusCode) { string result = messge.Content.ReadAsStringAsync().Result; description = result; } } catch(Exception ex) { Console.WriteLine(ex); } } }
Regards,
Arunkumar
I mean how can I use the PUT to update the component and DELETE to delete the component?
http://myserver/PUT/rest/api/2/projectkey/component/{id}
<code>http://myserver/
Is above link is right to update/delete the component? if wrong means kindly revert it!
thanks in advance.<br><br>
It looks like you're new here. Sign in or register to get started.