JIRA Rest API Login using C#

I've written below C# code to login to JIRA Rest API:

var url = new Uri("http://localhost:8090/rest/auth/latest/session?os_username=tempusername&os_password=temppwd");
var request = WebRequest.Create(url) as HttpWebRequest;
if (null == request)
return "";
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = 200;
request.KeepAlive = false;
using (var response = request.GetResponse() as HttpWebResponse)

When I execute this, application just goes on running without returning any response. Please suggest if this is the right way of calling JIRA Loin using REST API

2 answers

This widget could not be displayed.

Hi, as you are sending data via POST, you cannot simply add os_username and os_password to your URI string. Refer to the WebRequest documentation on how this can be done in C#.

Please refer to this link for an example on basic REST API authentication.

If you need OAuth, refer to this link.

This widget could not be displayed.

It's there a reason you only want to login? I generally just use HTTP Basic Auth with my REST request.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

78 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you