cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1356
Views
0
Helpful
1
Replies
Robert Crowe
Beginner

Getting 401 when I try to connect to Prime REST API

I'm trying to write a client for the Prime REST API in ASP.NET C#, but when I try to connect I get a 401 Unauthorized exception.  I've created a user and added him to the North Bound API group.  Using this code, I try to connect:

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

This seems to be about as simple as it could be, but it fails.  Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Robert Crowe
Beginner

Nevermind, I found the problem.  The user needs to be in the Admin group, not North Bound API.  The request /webacs/api/v1/data/AccessPoints was also a problem.

View solution in original post

1 REPLY 1
Robert Crowe
Beginner

Nevermind, I found the problem.  The user needs to be in the Admin group, not North Bound API.  The request /webacs/api/v1/data/AccessPoints was also a problem.

View solution in original post

Content for Community-Ad

This widget could not be displayed.