<?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 Update MS QOS Rules in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433137#M5357</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   I'm trying to update a previously GET qosRule using API. If I GET the QOS Rule I have something like this:&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;  "id" : "645703596574246393",&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"vlan" : null,&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"protocol" : "UDP",&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"srcPort" : null,&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;  &lt;/SPAN&gt;&lt;SPAN&gt;"dstPort"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"dscp" : NumberInt(46)&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt; as you can read vlan, srcPort and distort are null because I put "Any" from the Dashboard.&lt;/P&gt;&lt;P&gt;If I try to PUT the same JSON I receive an error because vlan, srcPort and distort should be integer and not 0.&lt;/P&gt;&lt;P&gt;What I'm doing wrong here? I tried to pass "Any" instead of null but the same error occurs.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Mar 2020 07:56:59 GMT</pubDate>
    <dc:creator>francesco.boscarino</dc:creator>
    <dc:date>2020-03-16T07:56:59Z</dc:date>
    <item>
      <title>Update MS QOS Rules</title>
      <link>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433137#M5357</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   I'm trying to update a previously GET qosRule using API. If I GET the QOS Rule I have something like this:&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;  "id" : "645703596574246393",&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"vlan" : null,&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"protocol" : "UDP",&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"srcPort" : null,&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;  &lt;/SPAN&gt;&lt;SPAN&gt;"dstPort"&lt;/SPAN&gt; &lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN class="Apple-converted-space"&gt;  &lt;/SPAN&gt;"dscp" : NumberInt(46)&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt; as you can read vlan, srcPort and distort are null because I put "Any" from the Dashboard.&lt;/P&gt;&lt;P&gt;If I try to PUT the same JSON I receive an error because vlan, srcPort and distort should be integer and not 0.&lt;/P&gt;&lt;P&gt;What I'm doing wrong here? I tried to pass "Any" instead of null but the same error occurs.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 07:56:59 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433137#M5357</guid>
      <dc:creator>francesco.boscarino</dc:creator>
      <dc:date>2020-03-16T07:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS QOS Rules</title>
      <link>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433138#M5358</link>
      <description>&lt;P&gt;Looks like you need to specify them, or just leave them out of the script.&lt;/P&gt;&lt;PRE&gt;"srcPort": 2000,&lt;BR /&gt;&lt;STRIKE&gt;"srcPortRange": null,&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;"dstPort": null,&lt;/STRIKE&gt;&lt;BR /&gt;"dstPortRange": "3000-3100",&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Mar 2020 08:38:55 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433138#M5358</guid>
      <dc:creator>ww^</dc:creator>
      <dc:date>2020-03-16T08:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS QOS Rules</title>
      <link>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433139#M5359</link>
      <description>&lt;P&gt;Untested, but I would do something like:&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;if row['vlan'] is None:
   del row['vlan']
if row['srcPort'] is None:
   del row['srcPort']
if row['dstPort'] is None:
   del row['dstPort']&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Mar 2020 18:13:05 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433139#M5359</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2020-03-16T18:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS QOS Rules</title>
      <link>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433140#M5360</link>
      <description>&lt;P&gt;In addition to Philip's idea, you can also do something like the below. Just modify or add checks as necessary to remove empty or Null returns.&lt;/P&gt;&lt;P&gt;This is copy-pasta from a script I use to update switchports. Script reads in JSON that's a result of GETting the switchport data, then adjusts it so I can later POST the result.&lt;/P&gt;&lt;P&gt;Edited to add: This is Python, because I love snakes.&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;for port in switchportsList:
    empties = []
    for key, value in port.items():
        if value == None:
            empties.append(key)
    for item in empties:
        try:
            port.pop(item)
        except:
            print(f"Couldn't pop {item}")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Mar 2020 21:45:13 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433140#M5360</guid>
      <dc:creator>Nash</dc:creator>
      <dc:date>2020-03-16T21:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS QOS Rules</title>
      <link>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433141#M5361</link>
      <description>&lt;P&gt;Thanks everybody, I found just few minutes later it was necessary not to specify null fields.&lt;/P&gt;&lt;P&gt;I think this should not be an API behavior as this logic should be inside API and not on caller.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 08:11:27 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/update-ms-qos-rules/m-p/5433141#M5361</guid>
      <dc:creator>francesco.boscarino</dc:creator>
      <dc:date>2020-03-17T08:11:27Z</dc:date>
    </item>
  </channel>
</rss>

