<?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 getOrganizationApplianceVpnStatuses  error 400 in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442688#M6623</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am new to Meraki API v1 and Python. I need to do a getOrganizationApplianceVpnStatuses query for all organizations. When I query an Org that doesn't have site-to-site VPN configured, it returns error 400 and the script stops.&lt;BR /&gt;How can I catch the error and avoid stopping the script?&lt;/P&gt;&lt;P&gt;I hope your help.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Sat, 26 Sep 2020 09:08:46 GMT</pubDate>
    <dc:creator>RobertoMateos7690</dc:creator>
    <dc:date>2020-09-26T09:08:46Z</dc:date>
    <item>
      <title>getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442688#M6623</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am new to Meraki API v1 and Python. I need to do a getOrganizationApplianceVpnStatuses query for all organizations. When I query an Org that doesn't have site-to-site VPN configured, it returns error 400 and the script stops.&lt;BR /&gt;How can I catch the error and avoid stopping the script?&lt;/P&gt;&lt;P&gt;I hope your help.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 09:08:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442688#M6623</guid>
      <dc:creator>RobertoMateos7690</dc:creator>
      <dc:date>2020-09-26T09:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442689#M6624</link>
      <description>&lt;P&gt;This sort of thing is pretty common with the API, especially when grabbing data across a wide scope, where you get an error rather than, say, null data.&lt;/P&gt;&lt;P&gt;You can handle it using Python's exception handling  &lt;A href="https://docs.python.org/3/tutorial/errors.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.python.org/3/tutorial/errors.html&lt;/A&gt;  this is also useful for coping with rate limiting.&lt;/P&gt;&lt;P&gt;For instance (cut/paste from a real script, this sits within a while loop that is part of the rate limit retry logic)...&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;        &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;try&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;&lt;/SPAN&gt;# get list of devices on network&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;devices = &lt;SPAN class="s1"&gt;&lt;STRONG&gt;await&lt;/STRONG&gt;&lt;/SPAN&gt; aiomeraki.networks.getNetworkDevices(net[&lt;SPAN class="s3"&gt;'id'&lt;/SPAN&gt;])&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;        &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;except&lt;/STRONG&gt;&lt;/SPAN&gt; meraki.AsyncAPIError &lt;SPAN class="s1"&gt;&lt;STRONG&gt;as&lt;/STRONG&gt;&lt;/SPAN&gt; e:&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN class="s2"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/SPAN&gt; "429 Too Many Requests" &lt;SPAN class="s1"&gt;&lt;STRONG&gt;in&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="s2"&gt; str(e):&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;                &lt;/SPAN&gt;time.sleep(&lt;SPAN class="s3"&gt;10&lt;/SPAN&gt; * attempt)&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;                &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;continue&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s2"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;print(f&lt;/SPAN&gt;'mrssids devices Meraki API error: {e}'&lt;SPAN class="s2"&gt;, file=sys.stderr)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;return&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;        &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;except&lt;/STRONG&gt;&lt;/SPAN&gt; Exception &lt;SPAN class="s1"&gt;&lt;STRONG&gt;as&lt;/STRONG&gt;&lt;/SPAN&gt; e:&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN class="s2"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;print(f&lt;/SPAN&gt;'mrssids devices some other error: {e}'&lt;SPAN class="s2"&gt;, file=sys.stderr)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;return&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;        &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;else&lt;/STRONG&gt;&lt;/SPAN&gt;:&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;&lt;/SPAN&gt;# only process if there's at least one device&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;            &lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/SPAN&gt; devices:&lt;/P&gt;&lt;P class="p1"&gt;        ...&lt;/P&gt;</description>
      <pubDate>Sun, 27 Sep 2020 11:12:59 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442689#M6624</guid>
      <dc:creator>sungod</dc:creator>
      <dc:date>2020-09-27T11:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442690#M6625</link>
      <description>&lt;P&gt;Thanks Godsun, but I have tried the following code and the problem persists:&lt;/P&gt;&lt;P&gt;Sorry, but the indentation doesn't work here.&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;import meraki&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;API_KEY = 'API-KEY'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;dashboard = meraki.DashboardAPI(API_KEY)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;responseOrg = dashboard.organizations.getOrganizations()&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;for rowOrg in responseOrg:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;try:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;organization_id = rowOrg['id']&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;response = dashboard.appliance.getOrganizationApplianceVpnStatuses(organization_id, total_pages='all') &lt;STRONG&gt;---&amp;gt; ERROR&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(response)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;except meraki.AsyncAPIError as e:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if "400 Bad Request" in str(e):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print("Error:")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;LOG:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;2020-09-27 20:57:08 meraki: INFO &amp;gt; GET &lt;A href="https://api.meraki.com/api/v1/organizations" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.meraki.com/api/v1/organizations&lt;/A&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;2020-09-27 20:57:09 meraki: INFO &amp;gt; organizations, getOrganizations - 200 OK&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;2020-09-27 20:57:09 meraki: INFO &amp;gt; GET &lt;A target="_blank" rel="noopener"&gt;https://api.meraki.com/api/v1/organizations/&amp;lt;ORG&amp;gt;/appliance/vpn/statuses&lt;/A&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;2020-09-27 20:57:10 meraki: ERROR &amp;gt; appliance, getOrganizationApplianceVpnStatuses - 400 Bad Request, {'errors': ['Site-to-site VPN not enabled in your organization']}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;When line whit tag ERROR is executed, the error occurs and the exception is not caught.The code does work with Org that have Site-to-site VPN configured, but with those that do not have it, this error occurs.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Sep 2020 19:28:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442690#M6625</guid>
      <dc:creator>RobertoMateos7690</dc:creator>
      <dc:date>2020-09-27T19:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442691#M6626</link>
      <description>&lt;P&gt;Are you using AIO? It appears you're trying to catch errors for it, yet are using the standard library calls. Please try something like the following:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;    &amp;lt;API Call&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;except meraki.APIError as e:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;    print(e)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;    print(e.status, e.reason)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;    pass:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;    &amp;lt;do something upon success&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 02:28:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442691#M6626</guid>
      <dc:creator>jonhar</dc:creator>
      <dc:date>2020-09-28T02:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442692#M6627</link>
      <description>&lt;P&gt;Hi JonH, thanks for all. I tried the following code, but when the exception occurred the script stopped and I don't query the rest of the organizations, is there a way to catch the error but continue to run the script?&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;import meraki&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;API_KEY = 'API-KEY'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;dashboard = meraki.DashboardAPI(API_KEY)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;OrgList=['IdOrg1','IdOrg2','IdOrg3']&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;def GetVpnOrg(idOrg):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;response = dashboard.appliance.getOrganizationApplianceVpnStatuses(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;i, total_pages='all'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;return response&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;try:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;for i in OrgList:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;VpnOrg = GetVpnOrg(i)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(VpnOrg)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;except meraki.APIError as e:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if "400 Bad Request" in str(e): &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(e)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(e.status, e.reason)&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 07:36:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442692#M6627</guid>
      <dc:creator>RobertoMateos7690</dc:creator>
      <dc:date>2020-09-28T07:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442693#M6628</link>
      <description>&lt;P&gt;Hello again, I think I have already understood the way to do it. I have tried the following code and it works according to my needs. Thank you all.&lt;/P&gt;&lt;PRE&gt;import meraki&lt;BR /&gt;&lt;BR /&gt;API_KEY = 'API-KEY'&lt;BR /&gt;dashboard = meraki.DashboardAPI(API_KEY)&lt;BR /&gt;OrgList=['IdOrg1','IdOrg2','IdOrg3']&lt;BR /&gt;&lt;BR /&gt;def GetVpnOrg(idOrg):&lt;BR /&gt;     response = dashboard.appliance.getOrganizationApplianceVpnStatuses(&lt;BR /&gt;     i, total_pages='all'&lt;BR /&gt;     )&lt;BR /&gt;     return response&lt;BR /&gt;&lt;BR /&gt;for i in lista:&lt;BR /&gt;     try:&lt;BR /&gt;          VpnOrg = GetVpnOrg(i)&lt;BR /&gt;     except meraki.APIError as e:&lt;BR /&gt;          if "400 Bad Request" in str(e): &lt;BR /&gt;          print(e)&lt;BR /&gt;          print(e.status, e.reason)&lt;BR /&gt;          VpnOrg = "NO VPN"&lt;BR /&gt;print(VpnOrg)&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 07:49:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442693#M6628</guid>
      <dc:creator>RobertoMateos7690</dc:creator>
      <dc:date>2020-09-28T07:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442694#M6629</link>
      <description>&lt;P&gt;In addition to try / except / else, you can use a "finally" statement at the end, that will be executed, irrespective of what happened before it.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:33:55 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442694#M6629</guid>
      <dc:creator>jonhar</dc:creator>
      <dc:date>2020-09-28T15:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442695#M6630</link>
      <description>&lt;P&gt;You can use the code block formatter when making a reply (under the ... menu) to add a code block that preserves formatting. Might help here, to better show your code!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 21:26:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442695#M6630</guid>
      <dc:creator>John-on-API</dc:creator>
      <dc:date>2020-09-28T21:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: getOrganizationApplianceVpnStatuses  error 400</title>
      <link>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442696#M6631</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you all.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:08:49 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/getorganizationappliancevpnstatuses-error-400/m-p/5442696#M6631</guid>
      <dc:creator>RobertoMateos7690</dc:creator>
      <dc:date>2020-09-29T06:08:49Z</dc:date>
    </item>
  </channel>
</rss>

