<?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: Active IQ API and swagger_client in Active IQ and AutoSupport Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-and-AutoSupport-Discussions/Active-IQ-API-and-swagger-client/m-p/160351#M1714</link>
    <description>&lt;P&gt;This was missing in the documentation until recently.&amp;nbsp; Following up on the earlier response, you can do this with HTTPS.&amp;nbsp; Here's an example from some recent code (load in pip3 modules as needed) and set token_data to your existing refresh token:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# use our refresh token content to get the latest access token&lt;BR /&gt;conn = http.client.HTTPSConnection( "api.activeiq.netapp.com" )&lt;BR /&gt;conn_data = json.dumps( { "refresh_token": token_data } )&lt;BR /&gt;conn.request( "POST", "/v1/tokens/accessToken", conn_data )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# get the response from the HTTPS request&lt;BR /&gt;res = conn.getresponse()&lt;BR /&gt;if res.status != 200:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print( "Could not get new token data based on current refresh token:", res.status, res.reason )&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return None&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# grab the token data&lt;BR /&gt;conn_data = json.loads( res.read().decode( "utf-8" ) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# reference conn_data['refresh_token'] or conn_data['access_token'] - remember to save the new refresh token!&lt;/P&gt;</description>
    <pubDate>Fri, 16 Oct 2020 20:53:56 GMT</pubDate>
    <dc:creator>mattaparity</dc:creator>
    <dc:date>2020-10-16T20:53:56Z</dc:date>
    <item>
      <title>Active IQ API and swagger_client</title>
      <link>https://community.netapp.com/t5/Active-IQ-and-AutoSupport-Discussions/Active-IQ-API-and-swagger-client/m-p/155883#M1611</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;According to the code examples, you have to use the swagger_client:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The following is the &lt;STRONG&gt;getAccessToken&lt;/STRONG&gt; API in &lt;STRONG&gt;Python&lt;/STRONG&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;from __future__ import print_statement&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;import time&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;import swagger_client&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;from swagger_client.rest import ApiException&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;from pprint import pprint&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;# create an instance of the API class&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;api_instance = swagger_client.AccessTokenApi()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;tokenManageraccessToken = &amp;nbsp;# TokenManageraccessToken |&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;try:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Generates a new access token using a valid refresh token.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; api_response = api_instance.get_access_token(tokenManageraccessToken)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pprint(api_response)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;except ApiException as e:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="terminal,monaco"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Exception when calling AccessTokenApi-&amp;gt;getAccessToken: %s\n" % e)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;After some googling I found that swagger_client needs to be custom built: &lt;A href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fswagger-api%2Fswagger-codegen%2F%23generating-libraries-from-your-server&amp;amp;data=02%7C01%7C%7C6ed9adf78d5e4d8feef408d7ec725b38%7Cc047d5c1d2a6484dae6eec2bce85d023%7C0%7C0%7C637237848209671996&amp;amp;sdata=fJuf%2Bd5MAEsNwu4Euk%2FMxmo1qE7an3ELJ97%2BjP00zmw%3D&amp;amp;reserved=0" target="_blank"&gt;https://github.com/swagger-api/swagger-codegen/#generating-libraries-from-your-server&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;How can the swagger_client library be installed in python? Typing &lt;FONT face="terminal,monaco"&gt;pip install swagger_client&lt;/FONT&gt; doesn't work. &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 11:11:10 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-and-AutoSupport-Discussions/Active-IQ-API-and-swagger-client/m-p/155883#M1611</guid>
      <dc:creator>WouterC</dc:creator>
      <dc:date>2025-06-04T11:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Active IQ API and swagger_client</title>
      <link>https://community.netapp.com/t5/Active-IQ-and-AutoSupport-Discussions/Active-IQ-API-and-swagger-client/m-p/156383#M1621</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Hi Wouter,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do not need to use the swagger client. You can just use the normal python HTTP client libraries to call the APIs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 15:19:44 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-and-AutoSupport-Discussions/Active-IQ-API-and-swagger-client/m-p/156383#M1621</guid>
      <dc:creator>BuddyT</dc:creator>
      <dc:date>2020-05-20T15:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Active IQ API and swagger_client</title>
      <link>https://community.netapp.com/t5/Active-IQ-and-AutoSupport-Discussions/Active-IQ-API-and-swagger-client/m-p/160351#M1714</link>
      <description>&lt;P&gt;This was missing in the documentation until recently.&amp;nbsp; Following up on the earlier response, you can do this with HTTPS.&amp;nbsp; Here's an example from some recent code (load in pip3 modules as needed) and set token_data to your existing refresh token:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# use our refresh token content to get the latest access token&lt;BR /&gt;conn = http.client.HTTPSConnection( "api.activeiq.netapp.com" )&lt;BR /&gt;conn_data = json.dumps( { "refresh_token": token_data } )&lt;BR /&gt;conn.request( "POST", "/v1/tokens/accessToken", conn_data )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# get the response from the HTTPS request&lt;BR /&gt;res = conn.getresponse()&lt;BR /&gt;if res.status != 200:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print( "Could not get new token data based on current refresh token:", res.status, res.reason )&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return None&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# grab the token data&lt;BR /&gt;conn_data = json.loads( res.read().decode( "utf-8" ) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# reference conn_data['refresh_token'] or conn_data['access_token'] - remember to save the new refresh token!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 20:53:56 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-and-AutoSupport-Discussions/Active-IQ-API-and-swagger-client/m-p/160351#M1714</guid>
      <dc:creator>mattaparity</dc:creator>
      <dc:date>2020-10-16T20:53:56Z</dc:date>
    </item>
  </channel>
</rss>

