JSON (or XML) request using GET, not POST?

Can anyone tell me if its possible, and if so, how to do it? I want to use JSON.ObjectFromURL or XML.ObjectFromURL methods (or even HTML.ObjectFromURL or something else entirely if it comes down to it) but as far as I can tell, these requests are always made with POST. Outside of Plex, the site I’m trying to reach seems to reject the request if its made using POST, but it works if I use GET. Inside of Plex, it always fails with the same error I get using POST outside of Plex, so it seems like Plex is always POSTing. Its easy enough to put all the parameters inside of the URL string within Plex, so GET should theoretically not be a problem, just so far, no luck. I’ve tried JSON.ObjectFromURL(myURL), JSON.ObjectFromURL(myURL, values=None), etc. but to no avail. Any help would be greatly appreciated.

Hi!



JSON.ObjectFromURL(myURL) is the correct way to grab the JSON file using GET (http://dev.plexapp.com/docs/api/parsekit.html?highlight=json.objectfromurl#JSON.ObjectFromURL). HTTP.Request, HTML.ElementFromURL, JSON.ObjectFromURL, etc. all use GET by default. Setting the ‘values’ parameter makes the request using POST.



Can you post your plugin code somewhere so we can have a look? The problem might be something completely different.

The “problem” isn’t much of one at all. After some more trial and error, I realized that the remote site responds to my request with an HTTP error code of 404 (i.e. not found) but that the expected JSON string is still contained within their response. I was just fixated on the 404 and didn’t notice that they were still sending me my data. Not sure why they’re doing this, I’d think they’d give a 200 back if they’re happy with the request. Thank you for your help.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.