Adding tag to multiple devices in same Systems Manager Network - 502 Bad Gateway Error Postman

nickydd9
Getting noticed

Adding tag to multiple devices in same Systems Manager Network - 502 Bad Gateway Error Postman

Hey all, 

 

Hoping someone might have some insight on an error I am getting in Postman. I am using the "Add, delete, or update the tags of a set of devices" endpoint and have modified it slightly so instead of using parameters in the URL, I am using JSON in the body instead simply because of the amount of MAC addresses involved for the scope of devices caused the URL to be too long. I have populated a bunch of fake MAC's below as an example, but in my real world test I am trying to add a tag to about 2000+ devices at the same time. Keep in mind this same PUT works if I trim it down to like 800 devices so I think I am hitting some sort of hard limit somewhere.

 

Body

 

{
"updateAction": "add",
"tags": "Test",
"wifiMacs": "00:60:EF:26:15:FE,00:60:EF:1B:07:AE,00:60:EF:1D:91:C9,00:60:EF:1D:91:CA,00:60:EF:1D:D3:36,00:60:EF:1D:D2:AB,44:8E:12:02:67:37,00:60:EF:1D:CF:D9,00:60:EF:19:2F:F8,00:A0:A4:25:4E:39,00:A0:A4:21:BE:45,00:A0:A4:21:BC:F2,00:60:EF:1D:91:BD,00:60:EF:1D:D4:22,00:A0:A4:21:C0:20,00:A0:A4:21:BF:DF,00:60:EF:1C:18:99,00:A0:A4:21:BF:E8,00:60:EF:1D:D4:48,00:A0:A4:21:C0:4F,00:A0:A4:21:B4:D0,00:60:EF:1C:77:2C,00:A0:A4:21:BD:DF,00:A0:A4:21:C0:1C,00:A0:A4:21:BD:E5,00:A0:A4:23:6E:5F,44:8E:12:02:67:9A,80:D2:1D:99:08:39,00:A0:A4:20:86:AF,00:60:EF:1D:D3:11,00:60:EF:1D:D2:D9,00:60:EF:16:01:DD,00:50:56:01:07:66,00:60:EF:19:31:97,00:A0:A4:21:1F:BD,80:EE:73:DC:70:14,80:EE:73:DC:6F:87,00:60:EF:1E:2B:2B,00:60:EF:1D:D5:23,00:60:EF:1E:29:40,00:60:EF:1E:29:09,00:A0:A4:19:61:40,00:A0:A4:19:61:C1,00:60:EF:1E:29:34,00:60:EF:13:5E:BF,00:60:EF:0D:2D:02,00:A0:A4:19:FF:BD,00:60:EF:1D:D1:09,00:A0:A4:19:AD:C5,00:A0:A4:19:AD:79,00:60:EF:1E:2A:12,1C:EE:C9:01:50:AC,00:A0:A4:19:AD:7A,00:60:EF:1D:D3:C9,1C:EE:C9:00:F8:A4,00:60:EF:1D:E9:7E,00:60:EF:1E:2A:36,00:60:EF:1D:E5:53,00:A0:A4:26:26:6A,00:60:EF:1E:27:65,00:A0:A4:20:E4:EA,1C:EE:C9:01:05:50,1C:EE:C9:01:4B:C8,00:A0:A4:21:07:4A

}

 

Again in some cases I get a 502 Bad Gateway error, if I bump up the "Request Timeout in MS" setting in postman to around 200000+ I then get a 500 Internal Server error. 

 

Any advice on how to get around this would be appreciated. I know I can splice my data into chunks and just do it that way, but if I can just do it in one dump that would be great. I will have to continually keep doing this in the future.

 

EDIT: Ignore all the smilies lol

6 REPLIES 6
PhilipDAth
Kind of a big deal
Kind of a big deal

As a matter of interest, what is the total size (in bytes) of the request you are trying to send?

 

I think you already know the answer and just need someone to confirm you are right - that there is a maximum request size and that will you need to break the request into batches.  🙂

I don't know that answer.

 

There is the action batches API as well you could consider using for this process (of breaking the request up):

https://developer.cisco.com/meraki/api/#/rest/guides/action-batches/

PhilipDAth
Kind of a big deal
Kind of a big deal

I haven't tried it - but does Postman allow you to gzip the request (aka gzip encoding) before sending it?

I took a look at action batches and gzip and both seem like they could have been valid solutions. 

 

My request size was 51.98kb.

 

I was able to solve actually by updating Postman to V7.0+ and somehow this has allowed my request to process. Not sure what exactly changed there but I appreciate your suggestions @PhilipDAth 

So scratch my previous response, I tried a larger batch (62kb) and I am back to 502 bad gateway.

 

Have been trying to gzip my request and send as binary file in Postman but I keep ending up with "400 bad request: error in JSON you submitted". 

 

I am not doing anything fancy, I am just taking the JSON from the body in Postman and saving it as a JSON file and using gzip to compess it, then adding the gzip file in Postman and sending the PUT request. The gzipped file is 13kb. 

 

It just seems to mangle my JSON when it gets gzipped and Postman can no longer understand it, however I do notice Postman automatically adds some temporary headers when it detects a gzip file.

 

Capture.PNG

PhilipDAth
Kind of a big deal
Kind of a big deal

>using gzip to compess it, then adding the gzip file in Postman and sending the PUT request

 

You would need to also tell it to add that it is gzip encoded in the HTTP header.  This is an example using curl:

http://yasassriratnayake.blogspot.com/2015/08/sending-gzip-request-using-curl.html

 

If I recall correctly, Postman has an option to export the code in other languages, like Python.  Perhaps try doing this in something else, as it sounds like it is Postman imposing the buffer size limit.

Seshu
Meraki Employee
Meraki Employee

@nickydd9 The error was seen on Postman, CURL Terminal and Mac OS Terminal using CURL commands. You can bypass it using a simple script to split the total list of MAC addresses into chunks of 800 and test again. 

 

Also, there is a bug with pending Meraki Support and you can reach out to them if you need more details.

Get notified when there are additional replies to this discussion.