Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not a customer? Start a free trial

Click the Start a free trial link to start a 15-day SaaS trial of our product and join our community as a trial user. If you are an existing customer do not start a free trial.

AppDynamics customers and established members should click the sign in button to authenticate.

Controller (SaaS, On Premises)

Python Code For Data Extraction using OAuth API Client

Vaibhav Vir.Singh

Python Code For Data Extraction using OAuth API Client


With recent release (4.5) we see "API Client" through which we can pull metric data via POST API.

Even though we have documentation available at

But I have not been able to execute it successully, so thought to check with you.


In below code, we have API Client named 'test21' and Account i am taking by default that is customer1.


Appreciate your help. 


geturl = 'https://'+ControllerPort+'/controller/api/oauth/access_token'
client_secret = '<<Secret_Copied>>'
data = {'grant_type': 'client_credentials','Content-Type': 'application/vnd.appd.cntrl+protobuf;v=1'}
access_token_response =, data=data, verify=False, allow_redirects=False, auth=('test21@customer1', client_secret))



By replying you agree to the Terms and Conditions of the AppDynamics Community.
Python Code For Data Extraction using OAuth API Client
Vaibhav Vir.Singh

Any Updates or Response?

Hi Vaibhav 


I am able to run this succcessfully. See the below command for your referance. 


curl -H "Authorization:Bearer Authkey ""

Vaibhav Vir.Singh

Hi Umerveli,
Thanks for confirming the same.
Could you please share your python code snippet?...

Hi vaibhav

I did not develop any python code...if you can share your full code i can test with my controller and get back to you.




Vaibhav Vir.Singh

I had already provided you with above. (Original mail)
You said you were able to extract, so was curious.
Even curl is not working for me which you mentioned.please elaborate that part of you can.

Appreciate it.

Do you have time for quick webex?

Vaibhav Vir.Singh

I am not sure if I can share it on WebEx.

Any help on above?

Ok lets take one step back.


the command I tested is curl -H "Authorization:Bearer Authkey ""


so when you create a API client from Adminstartion tab then make sure you use access token not the client secret

Under the roles I tried with Admin not sure which role you are trying but I am not saying that it should be an admin 




Vaibhav Vir.Singh

I tried above it is working (no issue with my setup)

My query is how to use secreta nd create token and use that for subsequent multiple REST API calls.