Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
10-16-2023 03:57 PM
Hi,
I am trying to access the REST API for an on-premises controller. I followed the instructions on this for my version of AppDynamics - API Clients (appdynamics.com)
I created an API Client, generated the client ID, secret and I am able to generate the token by accessing the 'controller/api/oauth/access_token' endpoint.
But when I use the Authentication token and/or the username/password for accessing any other endpoint, I am getting a 500 Internal Server Error response.
Any suggestions on how to resolve this?
Solved! Go to Solution.
10-16-2023 09:26 PM
Hi Pradeep,
Could you please do the following and let me know how it goes?
1. Go to the API Clients in Controller -> Go to the Settings => Administrator => API Client
2. Create an API client.
3. Enter the client Name, Description and Generate the Secret. Once the secret is generated, copy the secret and save it.
4. Assign the role.
4. Save it.
If you want to generate Token via CURL Command
5. run the below curl command to generate the token.
curl -X POST -H "Content-Type: application/vnd.appd.cntrl+protobuf;v=1" "https://test-controller.saas.appdynamics.com/controller/api/oauth/access_token" -d 'grant_type=client_credentials&client_id=<client-id>@account_name&client_secret=<secret>'
Replace <client-id> & <secret> accordingly.
client-id -> Client Name from Step 3
client_secret -> Secret from step 3
for example:
curl -X POST -H "Content-Type: application/vnd.appd.cntrl+protobuf;v=1" "https://test-controller.saas.appdynamics.com/controller/api/oauth/access_token" -d 'grant_type=client_credentials&client_id=sunil_api_client@ces-controller&client_secret=738e62b5-2455-45af-a644-934234234234'
Here is the docs for the details: https://docs.appdynamics.com/appd/23.x/latest/en/extend-appdynamics/appdynamics-apis/api-clients#id-...
10-17-2023 05:16 AM
Hi Sunil,
Thanks for your response. I am able to complete the steps from your solution and get the access token. But when I try to use the access token to access other APIs.
Example:
curl --user <username>@customer1:<password> -H "Authorization:Bearer <ACCESS TOKEN> "https://<controller page>/controller/rest/applications"
I am getting the following error:
<html><body><h1>500 Internal Server Error</h1><br/>Exception Id:f08d81b3-42c6-4a1e-a9ad-882dd210bad9<br/></body></html>
The same response when I try without the Access token as well. I am not sure why this happens.
10-18-2023 12:35 PM
Hi @Sunil.Agarwal,
Any idea how to resolve this?
I am still getting the same error. I even tried accessing it internally from the linux server running the controller and getting the same error.
10-18-2023 11:37 PM - edited 10-18-2023 11:39 PM
Hi Pradeep,
Thank you for providing the Curl command. I noticed that you've combined two different authorization methods in the same command, "Password-Based" and "Bearer Token." To proceed, please choose either "UsernamePassword" or "Bearer Token" for this command.
Here is the revised command; please try it and inform me of the results.
curl --user <username>@account-name:<password> "https://<controller page>/controller/rest/applications"
curl -H "Authorization:Bearer <ACCESS TOKEN> "https://<controller page>/controller/rest/applications"
10-20-2023 10:13 AM
The issue was related to license not updated in the account. It is working now after refreshing the license and account details in the admin page.
10-20-2023 10:22 AM
That's excellent news. You can always utilize the "-v" verbose option in the Curl command to access additional details about errors and other related information, which can be invaluable for troubleshooting issues. As we discussed during the Webex call, the root cause of your API issues was the expired license. It's reassuring to hear that this matter has now been resolved.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form