<?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: Updating MX Ports using Python API in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431910#M5169</link>
    <description>&lt;P&gt;No,&lt;/P&gt;&lt;P&gt;The MX will be installed not using a template. I want to script a new and fresh installation&lt;/P&gt;</description>
    <pubDate>Tue, 03 Mar 2020 13:04:39 GMT</pubDate>
    <dc:creator>Edgar-VO</dc:creator>
    <dc:date>2020-03-03T13:04:39Z</dc:date>
    <item>
      <title>Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431908#M5167</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I have been browsing through the forum and saw one thread for this item, but not using the same code examples. i would like to change the MX VLAN ports using the Python meraki API. This is different than the solution posted here where they use the request/REST function and not the api. I get a 200 Ok but the changing have not been done. I am a bit clueless now how to parse all this..&lt;/P&gt;&lt;P&gt;I want to update port 3 with a VLAN setting&lt;/P&gt;&lt;P&gt;A piece of code :&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;pay_load = &lt;/SPAN&gt;&lt;SPAN&gt;"{'enabled': True, 'type': 'access', 'dropUntaggedTraffic': False, 'vlan': 400, 'accessPolicy': 'open'}"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;pay_load = json.dumps(pay_load)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN&gt;result = dashboard.mx_vlan_ports.updateNetworkAppliancePort(def_network,&lt;/SPAN&gt;&lt;SPAN&gt;"3"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;param&lt;/SPAN&gt;&lt;SPAN&gt;=pay_load)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;meraki: INFO &amp;gt; MX VLAN ports, updateNetworkAppliancePort - 200 OK&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But unfortunately no change in port&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I think the problem is in parsing the arguments, but i am not sure ...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any ideas ?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Mar 2020 12:59:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431908#M5167</guid>
      <dc:creator>Edgar-VO</dc:creator>
      <dc:date>2020-03-03T12:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431909#M5168</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just to be sure. MX is bind to templated network or not ?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 13:00:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431909#M5168</guid>
      <dc:creator>damienleick1</dc:creator>
      <dc:date>2020-03-03T13:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431910#M5169</link>
      <description>&lt;P&gt;No,&lt;/P&gt;&lt;P&gt;The MX will be installed not using a template. I want to script a new and fresh installation&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 13:04:39 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431910#M5169</guid>
      <dc:creator>Edgar-VO</dc:creator>
      <dc:date>2020-03-03T13:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431911#M5170</link>
      <description>&lt;P&gt;I'm not sure if is the problem but in the Documentation there is some underscore in the put request :&lt;/P&gt;&lt;PRE&gt;mx_vlan_ports_controller.update_network_appliance_port(collect)&lt;/PRE&gt;&lt;P&gt;ref: &lt;A href="https://developer.cisco.com/meraki/api/#/python/api-endpoints/mx-vlan-ports/update-network-appliance-port" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.cisco.com/meraki/api/#/python/api-endpoints/mx-vlan-ports/update-network-appliance-port&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Your one is :&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;dashboard.mx_vlan_ports.updateNetworkAppliancePort&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 13:12:01 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431911#M5170</guid>
      <dc:creator>damienleick1</dc:creator>
      <dc:date>2020-03-03T13:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431912#M5171</link>
      <description>&lt;P&gt;Dashboard is the session ID &lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;dashboard = meraki.DashboardAPI(api_key)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;in the documentation they only work with the REST API and python request . I can do that as well of course :&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;url = base_url+&lt;/SPAN&gt;&lt;SPAN&gt;"/networks/"&lt;/SPAN&gt;&lt;SPAN&gt;+my_network_id+&lt;/SPAN&gt;&lt;SPAN&gt;"/appliancePorts/3"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;payload = json.dumps({&lt;/SPAN&gt;&lt;SPAN&gt;"enabled"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"true"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"type"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"access"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"vlan"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"400"&lt;/SPAN&gt;&lt;SPAN&gt;})&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;headers = {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'X-Cisco-Meraki-API-Key'&lt;/SPAN&gt;&lt;SPAN&gt;: api_key,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Content-Type'&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;'application/json'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;response = requests.request(&lt;/SPAN&gt;&lt;SPAN&gt;"PUT"&lt;/SPAN&gt;&lt;SPAN&gt;, url, &lt;/SPAN&gt;&lt;SPAN&gt;headers&lt;/SPAN&gt;&lt;SPAN&gt;=headers, &lt;/SPAN&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;SPAN&gt; = payload)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt;(response.text.encode(&lt;/SPAN&gt;&lt;SPAN&gt;'utf8'&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Then it works, but is not done using the official released meraki Python modules which you load with : import meraki&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Mar 2020 13:41:27 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431912#M5171</guid>
      <dc:creator>Edgar-VO</dc:creator>
      <dc:date>2020-03-03T13:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431913#M5172</link>
      <description>&lt;P&gt;The function is actually expecting the parameters in a different way.&lt;/P&gt;&lt;P&gt;Try changing it to:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;result = dashboard.mx_vlan_ports.updateNetworkAppliancePort(def_network,"3",vlan=400, accessPolicy="open", enabled = True, type="access",dropUntaggedTraffic=False)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Mar 2020 13:52:55 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431913#M5172</guid>
      <dc:creator>BrechtSchamp</dc:creator>
      <dc:date>2020-03-03T13:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431914#M5173</link>
      <description>&lt;P&gt;Okay,&lt;/P&gt;&lt;P&gt;We are almost there &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;  that part works, however i want to have that part in a variable which i can easily manipulate&lt;/P&gt;&lt;PRE&gt;vlan=400, accessPolicy="open", enabled = True, type="access",dropUntaggedTraffic=False&lt;/PRE&gt;&lt;P&gt;cause this does not work &lt;/P&gt;&lt;P&gt;pay_load = '&lt;SPAN&gt;enabled = True, type = "access", dropUntaggedTraffic = False, vlan = 400, accessPolicy = "open"'&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;result = dashboard.mx_vlan_ports.updateNetworkAppliancePort(def_network,&lt;/SPAN&gt;&lt;SPAN&gt;"3"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;pay_load)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TypeError: updateNetworkAppliancePort() takes 3 positional arguments but 4 were given&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Mar 2020 14:09:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431914#M5173</guid>
      <dc:creator>Edgar-VO</dc:creator>
      <dc:date>2020-03-03T14:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431915#M5174</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;params = {
    "vlan":400,
    "accessPolicy":"open", 
    "enabled" : True,
    "type":"access",
    "dropUntaggedTraffic":False
}

dashboard.mx_vlan_ports.updateNetworkAppliancePort(def_network, 3, **params)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Mar 2020 14:18:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431915#M5174</guid>
      <dc:creator>BrechtSchamp</dc:creator>
      <dc:date>2020-03-03T14:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431916#M5175</link>
      <description>&lt;P&gt;That works, thanks... been looking for that some time (but were afraid to ask &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;basically using a dict variable  and add/change values to it... Then the **params is setting a pointer to params values&lt;/P&gt;&lt;P&gt;Thnx for the help.... &lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 14:32:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431916#M5175</guid>
      <dc:creator>Edgar-VO</dc:creator>
      <dc:date>2020-03-03T14:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Updating MX Ports using Python API</title>
      <link>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431917#M5176</link>
      <description>&lt;P&gt;Yup kind of. In python terms it's called unpacking. If you want more information about it have a look here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://realpython.com/python-kwargs-and-args/#using-the-python-kwargs-variable-in-function-definitions" target="_blank" rel="nofollow noopener noreferrer"&gt;https://realpython.com/python-kwargs-and-args/#using-the-python-kwargs-variable-in-function-definitions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 14:51:04 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/updating-mx-ports-using-python-api/m-p/5431917#M5176</guid>
      <dc:creator>BrechtSchamp</dc:creator>
      <dc:date>2020-03-03T14:51:04Z</dc:date>
    </item>
  </channel>
</rss>

