<?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: How to handle invalid elements in the API in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448940#M7622</link>
    <description>&lt;P&gt;Well, although this doesn't help, I am happy to see that I am not alone in my frustration ... &lt;SPAN class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2023 12:32:08 GMT</pubDate>
    <dc:creator>Karsten Iwen</dc:creator>
    <dc:date>2023-10-17T12:32:08Z</dc:date>
    <item>
      <title>How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448936#M7618</link>
      <description>&lt;P&gt;I am still working on my script to copy an SSID between networks and change an SSID. But now I struggle with the implementation of the API.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I use &lt;SPAN&gt;getNetworkWirelessSsid to read the SSID and write the SSID with updateNetworkWirelessSsid.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But the API call getNetworkWirelessSsid gives me the following result for my test-SSID:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;{'authMode': '8021x-radius',
 'availabilityTags': [],
 'availableOnAllAps': True,
 'bandSelection': 'Dual band operation',
 'defaultVlanId': 999,
 'dot11r': {'adaptive': False, 'enabled': False},
 'dot11w': {'enabled': True, 'required': True},
 'enabled': True,
 'encryptionMode': 'wpa-eap',
...
 'wpaEncryptionMode': 'WPA2 only'}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The Schema Definition for updateNetworkWirelessSsid has some restrictions that make this invalid, and I can't write it back. For example, this SSID uses DOT1X authentication, but I get the element "encryptionMode" returned, which is only valid for PSK SSIDs. There are a couple of more restrictions where elements are dependent on each other.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do I handle this (and I will never understand why this invalid element is returned)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can only think of having if-conditions where I match each restriction and remove the element if this element is not allowed on this SSID:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;if source_ssid["authMode"] == '8021x-radius':
    source_ssid.pop('encryptionMode')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;But this is an extremely dirty workaround, and I need an individual function for each object I want to copy. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or is there a "switch" or "parameter" to tell the system to ignore everything that is not valid? At least I didn't find anything like this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any idea or advice?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 11:43:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448936#M7618</guid>
      <dc:creator>Karsten Iwen</dc:creator>
      <dc:date>2023-10-17T11:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448937#M7619</link>
      <description>&lt;P&gt;You are describing the endpoint that I hate the most. &lt;/P&gt;&lt;P&gt;You do a 'GET' of the SSID settings, you get bunch of nonsense , you try to 'PUT' the same exact data, you get bunch of errors &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt; fun&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 11:53:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448937#M7619</guid>
      <dc:creator>Raphael_L</dc:creator>
      <dc:date>2023-10-17T11:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448938#M7620</link>
      <description>&lt;P&gt;I applaud the effort and steadfastness &lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/17472"&gt;@Karsten Iwen&lt;/A&gt; but you could have done this manually by now &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 11:59:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448938#M7620</guid>
      <dc:creator>MerakiGnome</dc:creator>
      <dc:date>2023-10-17T11:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448939#M7621</link>
      <description>&lt;P&gt;I think big and not only for the 15 branches where I need it now ... &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And I also see it as a preparation for the DEVASC certification that I want to do eventually.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 12:28:53 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448939#M7621</guid>
      <dc:creator>Karsten Iwen</dc:creator>
      <dc:date>2023-10-17T12:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448940#M7622</link>
      <description>&lt;P&gt;Well, although this doesn't help, I am happy to see that I am not alone in my frustration ... &lt;SPAN class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 12:32:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448940#M7622</guid>
      <dc:creator>Karsten Iwen</dc:creator>
      <dc:date>2023-10-17T12:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448941#M7623</link>
      <description>&lt;P&gt;Here is the jist of it, using Python, for MR based networks:&lt;/P&gt;&lt;P&gt;First grab the settings from the source network:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;# Grab the current WiFi settings
ssidSettings=dashboard.wireless.getNetworkWirelessSsid(fromNetworkId,ssidNumber)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then copy all of the settings to the new network:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;# Build the SSID argument list
kwargs = {}
for setting in ssidSettings:
 kwargs[setting]=ssidSettings[setting]

dashboard.wireless.updateNetworkWirelessSsid(toNet['id'],**kwargs)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/1069"&gt;@jscorb&lt;/A&gt; probably has a better approach ...&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 20:52:43 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448941#M7623</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2023-10-17T20:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448942#M7624</link>
      <description>&lt;P&gt;I must be lucky not to have run into this yet using my approach above.  &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If that happened - you test for the invalids and delete from my kwargs that I build.  Or maybe if I specify kwargs that are not used, they get ignored by updateNetworkWirelessSsid.  I guess they would have to be ignored.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 20:55:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448942#M7624</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2023-10-17T20:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448943#M7625</link>
      <description>&lt;P&gt;And this is working for you Phil ? I don't have the same luck &lt;SPAN class="lia-unicode-emoji" title=":disappointed_face:"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Recently I can't copy my WPA2-Enterprise SSID settings. When I do the push It pukes couple errors about RadSecTLS timeouts ( which are not visible on the dashboard ). Opened a case , waiting ...&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 23:21:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448943#M7625</guid>
      <dc:creator>Raphael_L</dc:creator>
      <dc:date>2023-10-17T23:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448944#M7626</link>
      <description>&lt;P&gt;Yes, I've used it maybe 10 to 20 times to copy WiFi settings.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 00:25:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448944#M7626</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2023-10-18T00:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448945#M7627</link>
      <description>&lt;P&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/340"&gt;@Philip D'Ath&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I tend to follow old-school defensive programming practices...&lt;/P&gt;&lt;P&gt;There are API calls that return elements with a None value when they really shouldn't, or that change behaviour without notice, or that give the same data with different element names for no apparent reason.&lt;/P&gt;&lt;P&gt;Anything I need to rely on, I code to validate each element and then follow the rules to build the parameter list for the write operation. It's more effort, but still a lot easier than paper coding pads and opcode tables.&lt;/P&gt;&lt;P&gt;I know if I trust what an API response provides, there is a higher likelihood something will break, probably at 0200 on a Saturday.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 12:23:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448945#M7627</guid>
      <dc:creator>sungod</dc:creator>
      <dc:date>2023-10-18T12:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle invalid elements in the API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448946#M7628</link>
      <description>&lt;P&gt;My favorite example &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;get /networks/{networkId}/wireless/ssids &lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;{'authMode': '8021x-radius',
 'availabilityTags': [],
 'availableOnAllAps': True,
 'bandSelection': 'Dual band operation',
 'dot11r': {'adaptive': False, 'enabled': True},
 'dot11w': {'enabled': False, 'required': False},
 'enabled': True,
 'encryptionMode': 'wpa-eap',
 'ipAssignmentMode': 'Bridge mode',
 'lanIsolationEnabled': False,
 'mandatoryDhcpEnabled': False,
 'minBitrate': 11,
 'name': 'XXXXXX',
 'number': 0,
 'perClientBandwidthLimitDown': 0,
 'perClientBandwidthLimitUp': 0,
 'perSsidBandwidthLimitDown': 0,
 'perSsidBandwidthLimitUp': 0,
 'radiusAccountingEnabled': True,
 'radiusAccountingInterimInterval': 1200,
 'radiusAccountingServers': [{'caCertificate': None,
                              'host': 'XXXXX',
                              'id': 'XXXXXXX',
                              'openRoamingCertificateId': None,
                              'port': 1813},
                             {'caCertificate': None,
                              'host': 'XXXXXX',
                              'id': 'XXXXXX',
                              'openRoamingCertificateId': None,
                              'port': 1813}],
 'radiusAttributeForGroupPolicies': 'Airespace-ACL-Name',
 'radiusAuthenticationNasId': '$NODE_MAC$:$VAP_NUM$',
 'radiusCalledStationId': '$NODE_MAC$:$VAP_NAME$',
 'radiusCoaEnabled': True,
 'radiusFailoverPolicy': None,
 'radiusFallbackEnabled': False,
 'radiusLoadBalancingPolicy': None,
 'radiusOverride': True,
 'radiusProxyEnabled': False,
 'radiusRadsecTlsIdleTimeout': 900,
 'radiusServerAttemptsLimit': 3,
 'radiusServerTimeout': 1,
 'radiusServers': [{'caCertificate': None,
                    'host': 'XXXX',
                    'id': 'XXXXXX',
                    'openRoamingCertificateId': None,
                    'port': 1812},
                   {'caCertificate': None,
                    'host': 'XXXXXX',
                    'id': 'XXXXX',
                    'openRoamingCertificateId': None,
                    'port': 1812}],
 'radiusTestingEnabled': False,
 'speedBurst': {'enabled': False},
 'splashPage': 'None',
 'ssidAdminAccessible': False,
 'useVlanTagging': False,
 'visible': False,
 'wpaEncryptionMode': 'WPA2 only'}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; you try to push to a new network : &lt;/P&gt;&lt;P&gt;"RADIUS RADSec TLS idle timeout interval must be greater than RADIUS accounting interim interval"&lt;/P&gt;&lt;P&gt;remove "radiusRadsecTlsIdleTimeout" ( because where did that come from ? not present on the dashboard . I know 1200 &amp;gt; 900)&lt;/P&gt;&lt;P&gt;you get : 'encryptionMode' must be one of: 'wep' or 'wpa'&lt;/P&gt;&lt;P&gt;remove encryptionMod. It works.... &lt;/P&gt;&lt;P&gt;How hard is it to push the same payload that you got.... &lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 15:46:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-handle-invalid-elements-in-the-api/m-p/5448946#M7628</guid>
      <dc:creator>Raphael_L</dc:creator>
      <dc:date>2023-10-18T15:46:20Z</dc:date>
    </item>
  </channel>
</rss>

