Splunk AppDynamics

Not able to access Rest API using on-premises controller

Pradeep_Prakasa
Explorer

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?

Labels (3)
0 Karma
1 Solution

Pradeep_Prakasa
Explorer

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.

View solution in original post

0 Karma

Pradeep_Prakasa
Explorer

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.

0 Karma

Sunil_Agarwal
Communicator

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.

Pradeep_Prakasa
Explorer

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. 

0 Karma

Sunil_Agarwal
Communicator

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"
0 Karma

Sunil_Agarwal
Communicator

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'

Pradeep_Prakasa
Explorer

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.  

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...