Maybe 502 Bad Gateway is caused because there are too many output addresses.
I've seen this issue with the mass small payments before.
Maybe he should try to send in smaller chunks to all the users that have 0.01 BTC or more. If he is smart he will be able to avoid the required 0.0001 fee.
Then do the same with the smaller amounts ... and for the future double the "miner fee".
Their API worked fine with 138 outputs in the past. Tested with 108 outputs, same issue. Tested with 2 outputs and worked, but 2 outputs are not enough obviously. Anyways, sending the transaction and then responding with an error page is unacceptable so we are working on a solution to replace it. If the test goes well it can be deployed within a few hours.
If you are using the GET method described in their API you may be hitting the GET length limitation which may vary between the servers between 2kb and 8kb but then the transaction should fail then.
Error 502 - comes most likely from cloudflare. Probably somewhere they have "timeout" value to increase.
Maybe the only option is to break it into 3 parts:
- check the balance of the address used to send from
-- on error - fail
- try to send
-- on error - wait 1-2 minutes and check the balance of the address used to send from
https://blockchain.info/rawaddr/[ADDRES-SHERE]
--- if the amount stays the same then assume the operation has failed
--- if the amount got changed then then success - get the first TX id
-- on success use the returned TX
Otherwise good luck making bitcoind work