Controller (SaaS, On Premise)

cancel
Showing results for 
Search instead for 
Did you mean: 

401 unauthorized error in Rest Api

Wanderer

401 unauthorized error in Rest Api

Hi Team,

 

When I am trying to retrieve the Application Id from Postman. Getting 401 unauthorized error.

WWW-Authenticate →BASIC realm="controller_realm"

It was working earlier. I am able to login successfully to UI with the same credentials.

 

URL = https://myaccount.saas.appdynamics.com/controller/rest/applications/tiername

used basic authentication

username = <username>@mycompany.com

password = <password for AppDynamics UI>

 

I am getting 200 response with this URL

URL = https://myaccount.saas.appdynamics.com/controller/

 

Any help will be highly appreciated.

 

Thanks

Ranjot

 

 

Tags (3)
401 unauthorized error in Rest Api
4 REPLIES 4
Highlighted

Re: 401 unauthorized error in Rest Api

HI Ranjot, you should use the auth url 

 

/auth?action=login

 

which will set JSESSION_KEY and X-CSRF-TOKEN which you can then use on subsequent API calls so that you dont keep sending the username and password

 

for example have a look at my php code:

https://github.com/open768/phpinc/blob/master/appdynamics/core.php

 

which I use here https://www.chickenkatsu.co.uk/apps/reporter/

Wanderer

Re: 401 unauthorized error in Rest Api

I tried with the suggested solution.

https://myaccount.saas.appdynamics.com/controller/auth?action=login

It is giving me 499 CUSTOM status

 

Can you please suggest any alternative or solution for it.

 

Regards

Ranjot

Wanderer

Re: 401 unauthorized error in Rest Api

Hi Team

 

I scheduled a call as well from AppDynamics Tech Support team. But didnt get any call so far.

Please help.

 

Regards

Ranjot

Re: 401 unauthorized error in Rest Api

hi Ranjot,

 

why dont you post your code, its difficult to help without knowing what you are trying to achieve.

 

With the auth api call you have to send it your http authentication in the "Authorization:"  header which is the base64 encoded version of username@account:password

 

you can see an example of this in Appdynamics Dexter code aswell.

https://github.com/Appdynamics/AppDynamics.DEXTER/blob/master/ControllerApi/ControllerApi.cs

Tags (1)