<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Code For Data Extraction using OAuth API Client in Splunk AppDynamics</title>
    <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732846#M8174</link>
    <description>I am not sure if I can share it on WebEx.&lt;BR /&gt;&lt;BR /&gt;Others,&lt;BR /&gt;Any help on above?</description>
    <pubDate>Fri, 15 Feb 2019 16:38:52 GMT</pubDate>
    <dc:creator>Vaibhav_Vir_Sin</dc:creator>
    <dc:date>2019-02-15T16:38:52Z</dc:date>
    <item>
      <title>Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732839#M8167</link>
      <description>&lt;P&gt;Team,&lt;/P&gt;
&lt;P&gt;With recent release (4.5) we see "API Client" through which we can pull metric data via POST API.&lt;/P&gt;
&lt;P&gt;Even though we have documentation available at&amp;nbsp;&lt;A href="https://docs.appdynamics.com/display/PRO45/API+Clients" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.appdynamics.com/display/PRO45/API+Clients&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;But I have not been able to execute it successully, so thought to check with you.&lt;/P&gt;

&lt;P&gt;In below code, we have API Client named 'test21' and Account i am taking by default that is&amp;nbsp;&lt;EM&gt;customer1.&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Appreciate your help.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt; geturl = 'https://'+ControllerPort+'/controller/api/oauth/access_token'&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;EM&gt; client_secret = '&amp;lt;&amp;lt;Secret_Copied&amp;gt;&amp;gt;'&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;EM&gt; data = {'grant_type': 'client_credentials','Content-Type': 'application/vnd.appd.cntrl+protobuf;v=1'}&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;EM&gt; access_token_response = requests.post(geturl, data=data, verify=False, allow_redirects=False, auth=('test21@customer1', client_secret))&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;EM&gt; print(access_token_response.text)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 14:35:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732839#M8167</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2019-02-12T14:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732840#M8168</link>
      <description>&lt;P&gt;Any Updates or Response?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 21:02:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732840#M8168</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2019-02-13T21:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732841#M8169</link>
      <description>&lt;P&gt;Hi Vaibhav&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am able to run this succcessfully. See the below command for your referance.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;curl -H "Authorization:Bearer Authkey "&lt;A href="https://controller.appdynamics.com/controller/rest/applications" target="_blank" rel="nofollow noopener noreferrer"&gt;https://controller.appdynamics.com/controller/rest/applications&lt;/A&gt;"&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 04:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732841#M8169</guid>
      <dc:creator>Umervali_Niyama</dc:creator>
      <dc:date>2019-02-14T04:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732842#M8170</link>
      <description>Hi Umerveli,&lt;BR /&gt;Thanks for confirming the same.&lt;BR /&gt;Could you please share your python code snippet?...</description>
      <pubDate>Thu, 14 Feb 2019 05:18:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732842#M8170</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2019-02-14T05:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732843#M8171</link>
      <description>&lt;P&gt;Hi vaibhav&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;cheers&lt;/P&gt;
&lt;P&gt;Umer&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 04:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732843#M8171</guid>
      <dc:creator>Umervali_Niyama</dc:creator>
      <dc:date>2019-02-15T04:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732844#M8172</link>
      <description>I had already provided you with above. (Original mail)&lt;BR /&gt;You said you were able to extract, so was curious.&lt;BR /&gt;Even curl is not working for me which you mentioned.please elaborate that part of you can.&lt;BR /&gt;&lt;BR /&gt;Appreciate it.</description>
      <pubDate>Fri, 15 Feb 2019 05:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732844#M8172</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2019-02-15T05:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732845#M8173</link>
      <description>&lt;P&gt;Do you have time for quick webex?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 05:13:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732845#M8173</guid>
      <dc:creator>Umervali_Niyama</dc:creator>
      <dc:date>2019-02-15T05:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732846#M8174</link>
      <description>I am not sure if I can share it on WebEx.&lt;BR /&gt;&lt;BR /&gt;Others,&lt;BR /&gt;Any help on above?</description>
      <pubDate>Fri, 15 Feb 2019 16:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732846#M8174</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2019-02-15T16:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732847#M8175</link>
      <description>&lt;P&gt;Ok lets take one step back.&lt;/P&gt;

&lt;P&gt;the command I tested is&amp;nbsp;&lt;SPAN&gt;curl -H "Authorization:Bearer Authkey "&lt;/SPAN&gt;&lt;A href="https://controller.appdynamics.com/controller/rest/applications" target="_blank" rel="nofollow noopener noreferrer"&gt;https://controller.appdynamics.com/controller/rest/applications&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;so when you create a API client from Adminstartion tab then make sure you use access token not the client secret&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;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&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 06:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732847#M8175</guid>
      <dc:creator>Umervali_Niyama</dc:creator>
      <dc:date>2019-02-18T06:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732848#M8176</link>
      <description>&lt;P&gt;I tried above it is working (no issue with my setup)&lt;/P&gt;
&lt;P&gt;My query is how to use secreta nd create token and use that for subsequent multiple REST API calls.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vaibhav&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 20:57:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732848#M8176</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2019-02-28T20:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732849#M8177</link>
      <description>Any thoughts and help in this?</description>
      <pubDate>Wed, 20 Mar 2019 04:06:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732849#M8177</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2019-03-20T04:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732850#M8178</link>
      <description>&lt;P&gt;Just realized this thread i raised did not have any solution marked.&lt;/P&gt;&lt;P&gt;I accomplished so sharing for broader community.&amp;nbsp;&lt;/P&gt;&lt;P&gt;replace '&lt;EM&gt;token&lt;/EM&gt;' with big token string without quotes in the headers.&lt;/P&gt;&lt;P&gt;################&lt;/P&gt;&lt;P&gt;import requests&lt;/P&gt;&lt;P&gt;headers = {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Authorization': 'Bearer &lt;EM&gt;token&lt;/EM&gt;',&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;# Sample Query to fetch all applications&lt;/P&gt;&lt;P&gt;response = requests.get('https://&amp;lt;&amp;lt;CONTROLLERHOST&amp;gt;&amp;gt;:8181/controller/rest/applications', headers=headers, verify=False)&lt;/P&gt;&lt;P&gt;print(response.text) # OR response.content&lt;/P&gt;&lt;P&gt;################&lt;/P&gt;&lt;P&gt;Either you use Token directly like above, OR you can get token generated from secret of API Client like below:&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;FONT face="courier new,courier"&gt;curl -k -X POST -H "Content-Type: application/vnd.appd.cntrl+protobuf;v=1" "https://&amp;lt;&amp;lt;CONTROLLER:8181/controller/api/oauth/access_token&amp;nbsp;" -d “grant_type=client_credentials&amp;amp;client_id=XYZ@customer1&amp;amp;client_secret=4c45*****801”&lt;/FONT&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Regards,&lt;/P&gt;&lt;P data-unlink="true"&gt;VVS&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 17:43:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732850#M8178</guid>
      <dc:creator>Vaibhav_Vir_Sin</dc:creator>
      <dc:date>2021-05-28T17:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732851#M8179</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;To generate temporary access token using python, you can use request library of python .&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;generate_token_url&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"https://&amp;lt;Controller URL&amp;gt;/controller/api/oauth/access_token"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;payload&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"grant_type"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"client_credentials"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"client_id"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"Client_Id@ControllerName"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"client_secret"&lt;/SPAN&gt;&lt;SPAN&gt;:"fe&lt;/SPAN&gt;&lt;SPAN&gt;************************rf"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;token_headers&lt;/SPAN&gt;&lt;SPAN&gt; = { &lt;/SPAN&gt;&lt;SPAN&gt;"Content-Type"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"application/vnd.appd.cntrl+protobuf;v=1"&lt;/SPAN&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;generate_token_response&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;requests&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;request&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"POST"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;generate_token_url&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;headers&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;token_headers&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;SPAN&gt;=payload&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;json&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;print(generate_token_response["access_token"])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;you just need to change client_id and client_secret in payload&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 Mar 2022 11:16:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732851#M8179</guid>
      <dc:creator>keshav_Swami</dc:creator>
      <dc:date>2022-03-10T11:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python Code For Data Extraction using OAuth API Client</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732852#M8180</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;A href="https://community.appdynamics.com/t5/user/viewprofilepage/user-id/157381"&gt;@keshav.Swami&lt;/A&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for sharing that information. This is a peer-to-peer community, so helping others is key to the community's success&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 16:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Python-Code-For-Data-Extraction-using-OAuth-API-Client/m-p/732852#M8180</guid>
      <dc:creator>iamryan</dc:creator>
      <dc:date>2022-03-10T16:23:48Z</dc:date>
    </item>
  </channel>
</rss>

