I'm trying to use update_network_device to update the lat and lng of devices, and I just can't seem to get the API call to work.
I'm using something like:
from dotenv import load_dotenv
from meraki_sdk.meraki_sdk_client import MerakiSdkClient
from meraki_sdk.exceptions.api_exception import APIException
from meraki_sdk.models.update_network_device_model import UpdateNetworkDeviceModel
meraki = MerakiSdkClient(os.getenv("x_cisco_meraki_api_key"))
except APIException as e:
I just get back a "HTTP response not OK.". All other API calls work up to this point. So I'm confident the API key is correct. The API key belongs to an account that has sufficient rights to make the change.
For me it works fine in Postman when just specifying a lng and a lat. But as for you @PhilipDAth it fails with the SDK.
After some debuging I found that there are multiple issues.
First error: "moveMapMarker must be a boolean. So the SDK is putting moveMapMarker as null in the params if you don't specify it. The server is expecting true or false. It shouldn't even be specifying that param imo if you don't. But okay, I put in False in python which is then translated into false further on in the request params. Upon running with that change we arrive at the second error.
Second error: "Device's network must be bound to a configuration template (that supports switches) to allow for switch profile binding". Again, even though no switch_profile_id is specified in the device object, the SDK adds it into the parameters with a null value. The server doesn't accept that.
At this point I stopped debugging as there is no sensible value I can put in in the switch_profile_id... None gets translated to null as well so that won't help.