<?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: 400 Bad request:   While creating a new network in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414283#M2505</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/12821"&gt;@Vishnu2&lt;/A&gt; wrote:&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;'{"errors":["Invalid type"]}'&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm guessing this is the problem, but wireless should be a valid type. I'm kinda confused here &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;</description>
    <pubDate>Sun, 18 Nov 2018 21:48:58 GMT</pubDate>
    <dc:creator>jdsilva</dc:creator>
    <dc:date>2018-11-18T21:48:58Z</dc:date>
    <item>
      <title>400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414277#M2499</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The following is the python code I am using to create a new network. Tried so many times with little changes each time to figure out the problem but no luck.Here are the error codes and response I am getting:&lt;/P&gt;&lt;P&gt;error code : 400 bad request&lt;/P&gt;&lt;P&gt;response.text : '{"errors":["Invalid type"]}'&lt;/P&gt;&lt;P&gt;response.raise_for_status : 400 Client Error: Bad Request for url : &lt;A href="https://n57.meraki.com/api/v0/organizations/XXX/networks" target="_blank" rel="nofollow noopener noreferrer"&gt;https://n57.meraki.com/api/v0/organizations/XXX/networks&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Help me in understanding the problem ! what exactly is wrong with the code/data format.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;PRE&gt;import requests
import json



def isjson(data):
    try:
        json_object = json.loads(data)
    except ValueError:
        return False
    return True

url = 'https://api.meraki.com/api/v0/organizations/XXXXX/networks'

#payload = "  {\n    \"name\": \"office\",\n    \"timeZone\": \"CET\",\n    \"tags\": \"test\",\n    \"type\": \"wireless\"\n  }"

headers = {
    'X-Cisco-Meraki-API-Key': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json'
    }
payload={
    'name':'office',
    'timeZone':'CET',
    'tags':'test',
    'type':'wireless'
    }
parsed=json.dumps(payload)

if isjson(parsed):
      response = requests.post(url,headers=headers,data=parsed)
      print(response.text)&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Nov 2018 17:45:13 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414277#M2499</guid>
      <dc:creator>Vishnu2</dc:creator>
      <dc:date>2018-11-17T17:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414278#M2500</link>
      <description>&lt;P&gt;I'm just starting to learn Python, so I apologize if I'm not much help here.&lt;/P&gt;&lt;P&gt;That being said:&lt;/P&gt;&lt;P&gt;Error 400 = Bad Request- You did something wrong, e.g. a malformed request or missing parameter.&lt;/P&gt;&lt;P&gt;Just in case, I would change your POST command from n57 to just API, in case your shard in not accurate.&lt;/P&gt;&lt;P&gt;The error message you show is showing n57 but the python script is showing API.  Any link between the two somewhere else we are not seeing?&lt;/P&gt;&lt;P&gt;Also you have # in front of PAYLOAD.  Assuming that is supposed to be there?&lt;/P&gt;&lt;P&gt;Here are some things I found that might assist you:&lt;/P&gt;&lt;P&gt;&lt;A href="https://create.meraki.io/build/meraki-python-library-installation-guide/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://create.meraki.io/build/meraki-python-library-installation-guide/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/meraki/automation-scripts" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/meraki/automation-scripts&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.meraki.com/t5/Solutions-APIs/400-Bad-request-There-was-a-problem-in-the-JSON-you-submitted/m-p/18543" target="_blank"&gt;https://community.meraki.com/t5/Solutions-APIs/400-Bad-request-There-was-a-problem-in-the-JSON-you-submitted/m-p/18543&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/4381"&gt;@MacuserJim&lt;/A&gt;  &amp;lt;---- Jim here has a screenshot on another thread which appears to show how to create a new network.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.meraki.com/t5/Solutions-APIs/Creating-a-network-container-which-should-be-bound-to-a-template/m-p/30730" target="_blank"&gt;https://community.meraki.com/t5/Solutions-APIs/Creating-a-network-container-which-should-be-bound-to-a-template/m-p/30730&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Good luck and let me know how it goes, would love to learn from this.  ^_^&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2018 18:57:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414278#M2500</guid>
      <dc:creator>Nolan H.</dc:creator>
      <dc:date>2018-11-17T18:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414279#M2501</link>
      <description>&lt;P&gt;Thanks Nolan for your time and the links you posted.&lt;/P&gt;&lt;P&gt;Tried importing the Meraki package as &lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/4381" target="_blank"&gt;@MacuserJim&lt;/A&gt;&lt;SPAN&gt;  did, and still getting the same error (bad request- invalid type).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/12351"&gt;@Nolan Herring&lt;/A&gt;  I tried giving payload (string / json) directly to requests.post() as a data and ended up with the same error, Then I commented it to supply parsed json dictionary (jason=json.dumps(payload)).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/12351"&gt;@Nolan Herring&lt;/A&gt; About url:  It is redirected to n57 from api.meraki,com. I think that is &lt;/SPAN&gt;usual.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error remains&lt;/STRONG&gt; even after using meraki package. Any help would be great. &lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 08:29:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414279#M2501</guid>
      <dc:creator>Vishnu2</dc:creator>
      <dc:date>2018-11-18T08:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414280#M2502</link>
      <description>&lt;P&gt;Right off the hop I can see that you're not specifying a valid timezone. For CET you'd want to be specifying something like "Europe/Berlin" or Europe/Paris". &lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 17:21:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414280#M2502</guid>
      <dc:creator>jdsilva</dc:creator>
      <dc:date>2018-11-18T17:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414281#M2503</link>
      <description>&lt;P&gt;Changed time zone to specific one like you said, still the same error. Installed postman an hour ago and sent the POST request it is also giving the same error. &lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; response.text&lt;BR /&gt;'{"errors":["Invalid type"]}'&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; response&lt;BR /&gt;&amp;lt;Response [400]&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 18:36:57 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414281#M2503</guid>
      <dc:creator>Vishnu2</dc:creator>
      <dc:date>2018-11-18T18:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414282#M2504</link>
      <description>&lt;P&gt;Take a quick look at the documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://dashboard.meraki.com/api_docs#create-a-network" target="_self" rel="nofollow noopener noreferrer"&gt;https://dashboard.meraki.com/api_docs#create-a-network&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You'll first need to send a query to get your Organisation ID.  Check out the curl example as well.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 20:07:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414282#M2504</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2018-11-18T20:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414283#M2505</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/12821"&gt;@Vishnu2&lt;/A&gt; wrote:&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;'{"errors":["Invalid type"]}'&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm guessing this is the problem, but wireless should be a valid type. I'm kinda confused here &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;</description>
      <pubDate>Sun, 18 Nov 2018 21:48:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414283#M2505</guid>
      <dc:creator>jdsilva</dc:creator>
      <dc:date>2018-11-18T21:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414284#M2506</link>
      <description>&lt;P&gt;Well... &lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/12821"&gt;@Vishnu2&lt;/A&gt; your code works fine for me. Now I'm even more confused why it doesn't work for you.&lt;/P&gt;&lt;P&gt;It even took the CET for the timezone...&lt;/P&gt;&lt;P&gt;Does the API key you're using have the correct permissions to create a network in the Org you're working with?&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 22:20:40 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414284#M2506</guid>
      <dc:creator>jdsilva</dc:creator>
      <dc:date>2018-11-18T22:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414285#M2507</link>
      <description>&lt;P&gt;Just for the hell of it, try deleting:&lt;/P&gt;&lt;P&gt;type':'wireless'&lt;/P&gt;&lt;P&gt;And then manually type it back in.&lt;/P&gt;&lt;P&gt;I wonder if you have a strange non-printable character in that string.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 06:26:35 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414285#M2507</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2018-11-19T06:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414286#M2508</link>
      <description>&lt;P&gt;Is there any chance this network already exists, potentially as another type already?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 06:27:07 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414286#M2508</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2018-11-19T06:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414287#M2509</link>
      <description>&lt;P&gt;Thanks to All of you ! &lt;/P&gt;&lt;P&gt;Its executed, and network created.&lt;/P&gt;&lt;P&gt;There was a mistake in the argument type:'combined', Changed it to appliance, its working now.  Apologies that I have given wireless in the type, which invited confusion in troubleshooting. &lt;/P&gt;&lt;P&gt;Thanks for your support ! &lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 08:35:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414287#M2509</guid>
      <dc:creator>Vishnu2</dc:creator>
      <dc:date>2018-11-19T08:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad request:   While creating a new network</title>
      <link>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414288#M2510</link>
      <description>&lt;BLOCKQUOTE&gt;Meraki wrote:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The type of the new network. Valid types are 'wireless' (for MR), 'switch' (for MS), 'appliance' (for MX, Z-Series), 'phone' (for MC), &lt;STRONG&gt;or a space-separated list of those for a combined network&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://api.meraki.com/api_docs#create-a-network" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api.meraki.com/api_docs#create-a-network&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 15:32:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/400-bad-request-while-creating-a-new-network/m-p/5414288#M2510</guid>
      <dc:creator>jdsilva</dc:creator>
      <dc:date>2018-11-19T15:32:10Z</dc:date>
    </item>
  </channel>
</rss>

