Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can use REST Jira calls in browser, not in C# program

khooker
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2019

Hi all,

    I can log into my Jira cloud account with my username and password via chrome and then enter a Rest call on the address bar like this:

https://xyzonline.atlassian.net/rest/api/2/issue/10011

..and it returns the expected json issue object to my browser.   But an HttpWebResponse call in a C# program using the same credentials gets a 404 every time (method is a GET): 

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://xyzonline.atlassian.net/rest/api/2/issue/10011");
request.Credentials = new NetworkCredential("me@xyzonline.com""MyPass");
 
request.Method = httpMethod.ToString();
 
HttpWebResponse response = (HttpWebResponse)request.GetResponse();


...Same computer, seconds apart. Anyone see what I'm doing wrong?

 

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2019

Hello,

You need to generate API token instead of the password:

https://confluence.atlassian.com/cloud/api-tokens-938839638.html

khooker
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 22, 2019

Hi Alexey,

    I've tried that and it failed also but perhaps I have the syntax wrong.  Does anyone have the syntax for using the API-generated key in a simple C# / .Net example?

Suggest an answer

Log in or Sign up to answer