cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

unable to get token via api https://accountName.saas.appdynamics.com/controller/api/oauth/access_token

Tran.Vinh
Creator

I follow up on this doc to generate tokens via API but I didn't receive any response from the server.
https://docs.appdynamics.com/appd/4.5.x/en/extend-appdynamics/appdynamics-apis/api-clients#APIClient...
the curl like below:

curl -X POST -H "Content-Type: application/vnd.appd.cntrl+protobuf;v=1" "https://(accountName).saas.appdynamics.com/controller/api/oauth/access_token" -d 'grant_type=client_credentials&client_id=(username)@(accountName)&client_secret=(clientsecret)'
Please help me!



23 REPLIES 23

Tran.Vinh
Creator

@Mario.Morelli 
Sorry If I interrupt you but could you confirm for me about the trials controller can not get tokens via API? If you can not so Can you please give me the contact of people who can answer my question above?
Thanks.

Ryan.Paredez
Community Manager

Hi @Tran.Vinh,

I'm also trying to figure this out. I'll report back when I get an answer. 


Thanks,

Ryan, Cisco AppDynamics Community Manager




Found something helpful? Click the Accept as Solution button to help others find answers faster.

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.

Ryan.Paredez
Community Manager

Hi @Tran.Vinh,

I was asked to pass this along.

Can you please run this command with "curl -i" or verbose? It would be interesting to know if the server considers it a bad request or unauthorized.


Thanks,

Ryan, Cisco AppDynamics Community Manager




Found something helpful? Click the Accept as Solution button to help others find answers faster.

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.

Hi @Ryan.Paredez 
TesterTesterson_0-1678328997447.png

this is the result. I saw an internal server error with error code 500

Joe.Catera
AppDynamics Team

Hi @Tran.Vinh ,

You're using docs that are four years old. The request header has changed since 4.5 (the latest docs are 23.x), so the request should be the following:

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" "https://<controller address>/controller/api/oauth/access_token" -d 'grant_type=client_credentials&client_id=<apiClientName>@<accountName>&client_secret=<clientSecret>'

See https://docs.appdynamics.com/appd/23.x/latest/en/extend-appdynamics/appdynamics-apis/api-clients.

The request header is now the following:

Content-Type: application/x-www-form-urlencoded"

 I've been told that you should be able to use the Controller REST APIs with a trial license, BTW. 

Hi @Joe.Catera 
I tried sending a request flow your latest doc but I still have a new issue with 401 unauthorized

TranVinh_0-1678416071466.png

curl -i -X POST -H "Content-Type: application/x-www-form-urlencoded" -u "readyapi:683dfd51-60ea-4224-adc2-557e8d2212a0" "https://walker202302080517089.saas.appdynamics.com/controller/api/oauth/access_token" -d 'grant_type=client_credentials&client_id=readyapi@Waverley%20Software%20Inc&client_secret=683dfd51-60ea-4224-adc2-557e8d2212a0'
Could you help me check and correct if my syntax invalid
Thanks

Hi @Tran.Vinh ,

I'm not seeing anything wrong with your command syntax but am getting an "HTTP 401 Unauthorized" error. I'm asking one of our engineers to take a look to see if your command syntax is correct or if it's a credential issue. I'll get back to you next week with his response.

@Joe.Catera 
Do you have any update?

@Tran.Vinh , I asked an engineer to help in a support ticket, but I haven't heard back, so I wrote to the engineer directly. Sorry about the delay.

Joe.Catera
AppDynamics Team

@Tran.Vinh , the engineer wants to confirm  that you are using the correct parameters for the `client_id` parameter. Can you verify that `Waverley%20Software%20Inc` is your account name and that `readyapi` is your API client name? Since you are not getting an HTTP 500 error, in other words, it doesn't appear to be a syntax issue, that the authorization 401 error might be caused by incorrect credentials---at least that's what we're trying to determine.