Hi All I trying to create one project in JIRA through API by ASp.net Application. Below i giving my code. I not getting any exception. But Not adding project to JIRA. Where i doing mistake? string url = "https://actjira.atlassian.net/rest/api/2/project"; HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.ContentType = "application/json"; request.Method = "POST"; string base64Credentials = GetEncodedCredentials(); request.Headers.Add("Authorization", "Basic " + base64Credentials); request.ContentLength = data.Length; try { using (var reqStream = request.GetRequestStream()) using (StreamWriter writer1 = new StreamWriter(reqStream)) { writer1.Write(data); } } catch (Exception e1) { throw e1;// error handling code } private string GetEncodedCredentials() { string mergedCredentials = string.Format("{0}:{1}", "username", "password"); byte[] byteCredentials = UTF8Encoding.UTF8.GetBytes(mergedCredentials); return Convert.ToBase64String(byteCredentials); }
I reffered below urlhttps://docs.atlassian.com/jira/REST/latest/#api/2/project-createProject and Passing data
Please make sure REST API option is enabled in JIRA.
How can i check that? . I getting response from API.
You appear to be calling the create function without giving it any data.
Hi Nic Brough Thanks for your response. I passing data in same format below mentioned url. I not able to give here that format here i getting error when i click button https://docs.atlassian.com/jira/REST/latest/#api/2/project-createProject string data= "\"fields\": { \"project\": { \"id\": \"TJI\" }, \"description\": \"Hellow why doesn't this work\", \"summary\": \"REST ye merry gentlemen.\", \"issuetype\": { \"name\": \"Bug\" } } ";
string data passing to API
The fields in there are for issue creation/update, not project. Try sending it the correct data format, as listed in the link you've given.
It looks like you're new here. Sign in or register to get started.