Getting issue while Integrating Jira REST API

Hello Support,

Hope you are doing well!

I am Integrating Jira REST API using C# language. I need to fetch all the projects corresponding to specific user. I am using the following request Body

postUrl.Append("X-AUSERNAME=");          
postUrl.Append("singhharwinder@seasiainfotech.com");
 byte[] formbytes = System.Text.ASCIIEncoding.Default.GetBytes(postUrl.ToString());
 var webrequest = (System.Net.HttpWebRequest)WebRequest.Create("http://jira.atlassian.com/rest/api/2/project");          
 webrequest.Method = "POST";
  webrequest.ContentType = "application/json";
 webrequest.Headers.Add("X-AUSERNAME", "singhharwinder@seasiainfotech.com");
 using (System.IO.Stream postStream =
webrequest.GetRequestStream())
        {  
         postStream.Write(formbytes, 0, formbytes.Length);
        }
  System.IO.StreamReader reader = null;

But in response I am getting list of all projects irrespective of any specific user . Please let me know how can we fetch all the projects ofspecific user.

Thanks

Harwinder Singh

My C# is a bit rusty, but I don’t see you adding any authentication. You are adding a header for X-AUSERNAME but that’s not going to authenticate you. Try using Basic authentication.

1 Like