github update_ports script, 400 status code > resolved by removing port attributes from JSON data

SOLVED
Meraki_Dave
Here to help

github update_ports script, 400 status code > resolved by removing port attributes from JSON data

Hi all - 

 

I am using the update_ports script from https://github.com/meraki/automation-scripts

 

this used to work fine when I first used it a couple months ago - now I see a status of 400 in the API history when I run it. 

 

The script works fine to grab the data, but when it goes to PUT the data, it does not update the port. No errors while running the script. 

 

 

When I do a call to the API to see the last API PUT calls, it shows the postman call and the python script call as identical besides the user agent and return status. 

1 ACCEPTED SOLUTION

Hello @Meraki_Dave Meraki_Dave

 

what details for the port are you defining to update on the port. I'm noticing a problem with the following parameters you should be able to remove these if not required and the script should run.

macWhitelist
stickyMacWhitelist
stickyMacWhitelistLimit

View solution in original post

6 REPLIES 6
CBurkhead
Building a reputation

This is the issue being dealt with in the "which parameters in an API call are required" thread. I have been doing some work today in my own Python script (which does not use the Github code) and I cannot update a port, either. I am sending the data and I get a 200, but the port is not updated when I look at it in the dashboard. As far as I can tell, this is broken on the backend and Meraki is going to have to address it. Perhaps when this is fixed, it will also resolve the problem originally brought up in the other thread.

If that were the case, I would expect it would not work form Postman either, but it does. Not sure if its the same issue

 

2019-09-24_13-46-03.png

CBurkhead
Building a reputation

I have gotten the port to update. What I had to do does not make sense at the moment, but I am not going to worry about it. 

Hello @Meraki_Dave Meraki_Dave

 

what details for the port are you defining to update on the port. I'm noticing a problem with the following parameters you should be able to remove these if not required and the script should run.

macWhitelist
stickyMacWhitelist
stickyMacWhitelistLimit

the meraki github code pulls all of the attributes of the port into a variable, then updates the access policy variable and sends it back. 

 

I am not sure how to strip out any of the attribute before it sends the update to the switch. 

updatePort.JPG

Get notified when there are additional replies to this discussion.