- Trying to write a client for the Prime REST API in ASP.NET C#, but while trying to connect is showing a 401 Unauthorized exception. Have created a user and added him to the North Bound API group. Trying to connect using the code below:
IgnoreBadCertificates(); // accepts untrusted certificates
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"https://172.26.170.20/webacs/api/v1/data/AccessPoints");
string svcCredentials = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes("apiuser" + ":" + "apiuserpassword"));
req.Headers.Add("Authorization", "Basic " + svcCredentials);
WebResponse svcResponse = (HttpWebResponse)req.GetResponse(); // throws a 401
The user needs to be in the Admin group, not North Bound API. The request /webacs/api/v1/data/AccessPoints was also a problem.
Please sign in to leave a comment.