In recognition of Martin Luther King Day, our Support Centers will be open with limited hours on Monday (1/18) from 10AM ET to 6PM ET. Visit our Help Center to see all of the ways you can find answers to your questions.

API Access error : The remote server returned (401) Unauthorized.


API Access error : The remote server returned (401) Unauthorized.

HI ,



I am trying to access the events though api, but it is returning some error .  My requirement is that , i need to list all events in my web site , please check  my code below



string sUsername = "*****";       

string sPassword = "*****";       

string sAPIKey = "*******";


string sUri2 = "" + sUsername.ToLower() + "/events";


Uri addy = new Uri(sUri2);       

HttpWebRequest request = WebRequest.Create(addy) as HttpWebRequest;       

request.Credentials = new NetworkCredential((sAPIKey + "%" + sUsername), sPassword);       

request.Method = "GET";       

request.Accept = "application/atom+xml";       

request.ContentType = "application/atom+xml";       

HttpWebResponse response = request.GetResponse() as HttpWebResponse;       

StreamReader srResponse = new StreamReader(response.GetResponseStream());       

string xml = srResponse.ReadToEnd().ToString();




I think this will do what you are looking for. Please let me know if this resolves your issue?


string sUsername = "YOUR USERNAME";
string sPassword = "YOUR PASSWORD";
string sAPIKey = "YOUR API KEY";

NetworkCredential loginInfo = new NetworkCredential(sAPIKey + "%" + sUsername, sPassword);

HttpWebRequest ctctRequest = (HttpWebRequest)WebRequest.Create(""+sUsername+"/events");
ctctRequest.Method = "GET";
ctctRequest.Credentials = loginInfo;
ctctRequest.Accept = "application/atom+xml";

HttpWebResponse ctctResponse = ctctRequest.GetResponse() as HttpWebResponse;
StreamReader responseStream = new StreamReader(ctctResponse.GetResponseStream());
string responseText = responseStream.ReadToEnd();


David J

Developer Portal

View API documentation, code samples, get your API key.

Visit Page