<?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: DNAC 2.3.3.4 - API response is empty in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4678805#M8857</link>
    <description>&lt;P&gt;My pleasure. Happy to help.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2022 15:44:58 GMT</pubDate>
    <dc:creator>Andrea Testino</dc:creator>
    <dc:date>2022-08-30T15:44:58Z</dc:date>
    <item>
      <title>DNAC 2.3.3.4 - API response is empty</title>
      <link>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4677935#M8854</link>
      <description>&lt;P&gt;The script below is working in DNAC version 2.2.3.5 (Cisco DNA Center Platform 1.6.1.162) and stopped working when DNAC was upgraded to version 2.3.3.4 (Cisco DNA Center Platform 1.8.1.120)&lt;/P&gt;&lt;P&gt;What should I change in the script to have it working? I could not find anything in the release notes about changes for the API.&lt;/P&gt;&lt;P&gt;Top of the script is omitted...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Get count of devices
headers = {'X-Auth-Token': token, 'Content-Type': 'application/json'}
DEVICES_COUNT_URL = '/dna/intent/api/v1/network-device/count'
response = requests.get(BASE_URL + DEVICES_COUNT_URL,
                        headers=headers, verify=False)

# Print device count
print(response.json()['response'])

# Get device
query_params = {
    'family': 'cat9k'
}
DEVICES_URL = '/dna/intent/api/v1/network-device'
response = requests.get(BASE_URL + DEVICES_URL,
                        params=query_params,
                        headers=headers, verify=False)
device_id = response.json()
print("Device ID: ", device_id)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The output is shown below. As you can see the "network-device/count" is working and the "response" for a specific device is empty.&lt;/P&gt;&lt;P&gt;Execute script: ./sdalab_get-devices.py&lt;BR /&gt;&lt;STRONG&gt;11&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Device ID: {'response': [], 'version': '1.0'}&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 10:53:41 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4677935#M8854</guid>
      <dc:creator>thisd00d</dc:creator>
      <dc:date>2022-08-29T10:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: DNAC 2.3.3.4 - API response is empty</title>
      <link>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4678652#M8855</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;The response is empty because your query_params seems to be invalid. Below are some example definitions for "family"&amp;nbsp;&lt;EM&gt;(also sharing Series &amp;amp; Type in case it helps):&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;atestini@ubuntu-atestini:~$ python3 support.py | grep -i "type\|family\|series"
               'family': 'Switches and Hubs',
               'series': 'Cisco Catalyst 9300 Series Switches',
               'type': 'Cisco Catalyst 9300 Switch',
               'family': 'Switches and Hubs',
               'series': 'Cisco Catalyst 3850 Series Ethernet Stackable Switch',
               'type': 'Cisco Catalyst38xx stack-able ethernet switch',
               'family': 'Switches and Hubs',
               'series': 'Cisco Catalyst 9200 Series Switches',
               'type': 'Cisco Catalyst 9200 Switch Stack',&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above is the result of modifying the provided .py to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Get devices with below family
query_params = {
    'family': 'Switches and Hubs'
}
DEVICES_URL = '/dna/intent/api/v1/network-device'
response = requests.get(BASE_URL + DEVICES_URL,
                        params=query_params,
                        headers=headers, verify=False)
# pprint(response.json())

#Print Device ID and Hostname for every device in response
for device in response.json()['response']:
    print('DeviceID: {0}, Hostname: {1}'.format(device['id'], device['hostname']))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can now retrieve a list of Device IDs&amp;nbsp;against the network-device endpoint.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;atestini@ubuntu-atestini:~$ python3 support.py
8
DeviceID: db0f68f5-b807-4047-b2c7-7999533bcdd8, Hostname: LON-C9K-1
DeviceID: d593df57-7c78-4ea3-8424-f4c2a8684ea6, Hostname: LON-C9K-2
DeviceID: 874aa80f-81c0-4567-9b52-e9e93a2ab0c0, Hostname: TEST-C3850-1
DeviceID: 5a61c67f-1554-4640-bed6-ea32a5446f44, Hostname: TEST-C3850-3
DeviceID: 2938685d-1c99-4be5-a11e-94b47b0901cf, Hostname: TEST-C9K-1
DeviceID: c8980f50-4329-4af1-8c05-19ff263d80fe, Hostname: TEST-C9K-2&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;P.S:&lt;/STRONG&gt; The only time I've seen &lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;'family': 'cat9k'&lt;/STRONG&gt;&lt;/FONT&gt; is in the context of SWIM API endpoints. Some samples below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;atestini@ubuntu-atestini:~$ curl -k --location --request GET 'https://10.100.14.133/api/v2/device-image/device?id=d593df57-7c78-4ea3-8424-f4c2a8684ea6' \
--header 'x-auth-token: &amp;lt;redacted&amp;gt;' \
--header 'Cookie: JSESSIONID=1slxn2yjltj3o1hgraycvznn2o'&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;{
    "response": [
        {
            "deviceId": "d593df57-7c78-4ea3-8424-f4c2a8684ea6",
            "productType": "Cisco Catalyst 9300 Switch",
            "productSeries": "Cisco Catalyst 9300 Series Switches",
            "productFamily": "Switches and Hubs",
            "deviceImageUpgradeStatus": "OUTDATED",
            "deviceInstalledInfo": [
                {
                    "imageUuid": null,
                    "name": "CAT9K[17.06.01.0.250]",
                    "type": "SYSTEM",
                    "version": "17.06.01.0.250",
                    "displayVersion": "17.6.1",
                    "family": "CAT9K", 
                    "golden": false,
                    "subpackageType": null
                },
                {
                    "imageUuid": "6c27c035-9848-40d1-8f74-d888e8f668bf",
                    "name": "C9800-SW-iosxe-wlc.17.06.01.SPA.bin",
                    "type": "SUBPACKAGE",
                    "version": "17.06.01.0.250",
                    "displayVersion": "17.06.01.0.250",
                    "family": "CAT9K",
                    "golden": false,
                    "subpackageType": null
                }
            ],
            "targetImageInfo": [
                {
                    "imageUuid": "6d4bb9d6-5111-45b8-8b52-4fb39dbc5089",
                    "name": "cat9k_iosxe.17.03.05.SPA.bin",
                    "family": "CAT9K", 
                    "version": "17.03.05.0.6600",
                    "displayVersion": "17.03.05",
                    "md5Checksum": "62dcae59c73eb99aa54969b4da5a7c84",
                    "shaCheckSum": "b57e5a44cca1874b698653e8b967baf149beae8537cd1acfce0f18c80ccbbc01e2013cfb0dcbe69b82e234d957b0c1d57f89c796812ac2017e263dc52ddad556",
                    "createdTime": "2022-05-27 03:27:00.544",
                    "imageType": "SYSTEM_SW",
&amp;lt;snip&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 12:15:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4678652#M8855</guid>
      <dc:creator>Andrea Testino</dc:creator>
      <dc:date>2022-08-30T12:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: DNAC 2.3.3.4 - API response is empty</title>
      <link>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4678676#M8856</link>
      <description>&lt;P&gt;Thank you very much &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/279267"&gt;@Andrea Testino&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was indeed the issue. After adjusting the query_params the response is working. You are right that I was working on the &lt;A href="https://developer.cisco.com/docs/dna-center/#!swim/software-image-management-guide" target="_self"&gt;SWIM API example&lt;/A&gt; and that is why this mistake happened.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 13:06:28 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4678676#M8856</guid>
      <dc:creator>thisd00d</dc:creator>
      <dc:date>2022-08-30T13:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: DNAC 2.3.3.4 - API response is empty</title>
      <link>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4678805#M8857</link>
      <description>&lt;P&gt;My pleasure. Happy to help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 15:44:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/dnac-2-3-3-4-api-response-is-empty/m-p/4678805#M8857</guid>
      <dc:creator>Andrea Testino</dc:creator>
      <dc:date>2022-08-30T15:44:58Z</dc:date>
    </item>
  </channel>
</rss>

