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 url
https://docs.atlassian.com/jira/REST/latest/#api/2/project-createProject and Passing data
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\" } } ";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
string data = "{\"key\": \"EX1\",\"name\": \"Example1\",\"projectTypeKey\": \"software\",\"description\": \"Example Project description\",\"url\": \"http://actjira.atlassian.net\"}" I tried this. But not working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, is EX1 a valid project key in your system? What error message / response are you getting to this call?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I try to create new project with this key. I not getting any error message or response But when i debug my code below mentioned code executing using (var reqStream = request.GetRequestStream()) using (StreamWriter writer1 = new StreamWriter(reqStream)) { writer1.Write(data); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There's always a response of some sort, unless the call works, so my best guess is that your code is not actually performing the call, or it's not processing the response. I can't help you with your .net code, I don't use it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you able to say what are the possibility of non performing call?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Start by ignoring your code. On a command line, try a simple "curl" call to create the project (have a look at the example code in the docs for doing that). That will always give you a response of some sort. If it fails, you'll get an error telling you why. If it works, then you know your code is not performing the call.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you're on Server, check Admin -> General Settings -> Remote API is enabled (it is on by default) If you're on Cloud, then it's enabled.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Toady i getting error message from Jira when i try to add project. That messge i giving below StatusCode: MethodNotAllowed, Content-Type: text/html;charset=UTF-8, Content-Length: 0 whats meaning of this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please make sure REST API option is enabled in JIRA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.