Trying to use URI library to generate JSON in the proper formate for Eventbrite batch endpoint but not getting the right encoding from URI library.
url = URI.escape('{"method":"GET", "relative_url":"users/me"},{"method":"GET", "relative_url":"users/me/owned_events/"},{"method":"GET", "relative_url":"users/me/owned_events/?page=2"}')
=>%7B%22method%22:%22GET%22,%20%22relative_url%22:%22users/me%22%7D,
%7B%22method%22:%22GET%22,%20%22relative_url%22:%22users/me/owned_events/%22%7D,
%7B%22method%22:%22GET%22,%20%22relative_url%22:%22users/me/owned_events/?page=2%22%7D
This is the require encoding:
%5B+++++%7B%22method%22%3A%22GET%22%2C+%22relative_url%22%3A%22users%2Fme
%22%7D%2C+++++%7B%22method%22%3A%22GET%22%2C+%22relative_url%22%3A
%22users%2Fme%2Fowned_events%2F%22%7D%2C+++++%7B%22method%22%3A%22GET
%22%2C+%22relative_url%22%3A%22users%2Fme%2Fowned_events%2F%3Fpage%3D2%22%7D+%5D
CGI.escapeandCGI.unescape, only the "required encoding" has spaces and newlines. Are you sure this is the source of whatever problem you are experiencing? It might very well not be..eventbriteapi.com/v3/batch, and you should submit the array of JSONs via POST.CGI.escape('[{"method":"GET", "relative_url":"users/me"},{"method":"GET", "relative_url":"users/me/owned_events/"},{"method":"GET", "relative_url":"users/me/owned_events/?page=2"}]')looks much more similar to your desired outcome.