I have both VBA and C# code which calls the Jira REST API. All was working succesfully until the change to Atlassian account (for us in May 2017). Since then I cannot get past the authorisation error "Specified value has invalid HTTP Header characters".
The C# code that I'm using is below (which was working perfectly), where the credentials are base64 encoding of "email:password" for a valid authenticated user :
public string RunQuery(string query, string argument = null, string data = null, string method = "GET")
{
try
{
m_BaseUrl = query;
HttpWebRequest newRequest = WebRequest.Create(m_BaseUrl) as HttpWebRequest;
newRequest.ContentType = "application/json";
newRequest.Method = method;
if (data != null)
{
using (StreamWriter writer = new StreamWriter(newRequest.GetRequestStream()))
{
writer.Write(data);
}
}
string base64Credentials = GetEncodedCredentials();
newRequest.Headers.Add("Authorization: ", "Basic " + base64Credentials);
HttpWebResponse response = newRequest.GetResponse() as HttpWebResponse;
string result = string.Empty;
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
result = reader.ReadToEnd();
}
newRequest = null;
response = null;
return result;
}
Any help would be greatly appreciated