How to deal with "Payload content length greater than maximum allowed: 512000." with api/v2/jobs/users-imports

Which SDK this is regarding: v2
Platform: .NET core (but regards all tech)

I’m generally interested how one can prevent “Payload content length greater than maximum allowed: 512000.” with api/v2/jobs/users-imports
Since my payload is variable I can’t split my payload in equal parts or limit through a N amount of items.
Only way I see possible is to measure per json element and collect size information per individual user in my users to import set.

I do think this is very inconvenient on our side, also 512000 bytes isn’t that big

Hi @casper1

I know this is a weird error, there actually is a reason for it though I can never remember what it is.

You have the right idea: the best approach I have found is to keep a “buffer” object. That object knows how long it currently is. Each time you add a user, you calculate the length of the user, and check to see if that overflows the 512K length.

John