I am developing a .NET application to retrieve all Jira tickets from a specific project, which I’m naming ‘DevProject.’ However, when I attempt to use the Jira API, I either receive an empty response or encounter a 404 error. I suspect I might be overlooking something but I’m not exactly sure what it is.
The base URL for my company’s Jira account is ‘https://mycompany.atlassian.net,’ and I am using ‘/rest/api/3/issue/devissue’ for the REST URL. Here’s a code snippet illustrating my approach:
HttpWebResponse apiResponse = null;
HttpWebRequest apiRequest = WebRequest.Create(baseurl + restUrl) as HttpWebRequest;
apiRequest.Method = "GET";
apiRequest.Accept = "application/json";
apiRequest.ContentType = "application/json";
apirequest.Headers.Add("Authorization", "Basic " + EncodeCredentials("myUsername", "token"));
string data;
using (apiResponse = apiRequest.GetResponse() as HttpWebResponse)
{
StreamReader streamReader = new StreamReader(apiResponse.GetResponseStream());
data = streamReader.ReadToEnd();
}
I have also attempted using an API token in the password section, but that didn’t yield any results. I’m hoping to get back either a list of issues or any response that confirms whether I am correctly calling the API or if there is something I need to adjust. Any insights would be appreciated. Additionally, I’ve already generated an API token using my company’s Jira services.