How to send HTTP POST containing JSON body

edited April 2016 in Android Mode

I'm trying to use the 'HTTP Requests for Processing' library, but it seems to be specifically tailored to sending form-encoded requests. Is anyone able to use this to make calls against a REST API with JSON content?

Tagged:

Answers

  • edited April 2016

    Well, I've moved on - fortunately I have control over the service I'm connecting to, so I can send the JSON as if it were a form field, and extract it on the receiving end. Now this works from my computer in Java mode, but when I build a similar client on Android, I'm not getting anything at the server. I have verified using the phone's browser that I can do a GET from this URL. But POST is still a struggle...

  • Answer ✓

    we've been asked this before. and i ended up adding json content support to a fork of the processing library for http.

    BUT i don't think the underlying apache library for android is the same as the underlying apache library for PCs, it's a cut down version. so that might be your problem.

  • Thanks - in the end, I just created a simple bare-bones POST class of my own. I am pretty sure you are correct about the issue with the Apache library.

Sign In or Register to comment.