Community Record
4
Posts
0
Kudos
1
Solution
Nov 19 2018
12:35 AM
Thanks to All of you ! Its executed, and network created. 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. Thanks for your support !
... View more
Nov 18 2018
10:36 AM
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. >>> response.text '{"errors":["Invalid type"]}' >>> response <Response [400]> >>>
... View more
Nov 18 2018
12:29 AM
Thanks Nolan for your time and the links you posted. Tried importing the Meraki package as @MacuserJim did, and still getting the same error (bad request- invalid type). @NolanHerring 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)). @NolanHerring About url: It is redirected to n57 from api.meraki,com. I think that is usual. Error remains even after using meraki package. Any help would be great.
... View more
Nov 17 2018
9:45 AM
Hi, 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: error code : 400 bad request response.text : '{"errors":["Invalid type"]}' response.raise_for_status : 400 Client Error: Bad Request for url : https://n57.meraki.com/api/v0/organizations/XXX/networks Help me in understanding the problem ! what exactly is wrong with the code/data format. Thanks 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)
... View more
Labels:
- Labels:
-
Dashboard API
My Accepted Solutions
Subject | Views | Posted |
---|---|---|
12216 | Nov 19 2018 12:35 AM |