You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by John Whitmore <ar...@gmail.com> on 2015/09/07 11:32:15 UTC

Cannot Add small JSON object to the url of a post request

Hello all,

Just joined as I'm trying to find a way to send a JSON object in a URL. So
something like:

http://myserver.com/save/{"data":"String"}/

On the server side I'm using Django and if I put the above into the browser
directly then it works fine. But I'm trying this from an Android device and
whilst I've been using the apache httpclient so far for things and it works
great this little part is having a problem as the "{" is an illegal character.

The best solution I could find was from this post:

http://stackoverflow.com/questions/6218143/how-to-send-post-request-in-json-using-httpclient

But that doesn't add the json to the url.

Just wondering is there a simple way to get around the illegal character "{"
in a URL?

John

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Cannot Add small JSON object to the url of a post request

Posted by Michael Osipov <mi...@apache.org>.
Am 2015-09-07 um 11:32 schrieb John Whitmore:
> Hello all,
>
> Just joined as I'm trying to find a way to send a JSON object in a URL. So
> something like:
>
> http://myserver.com/save/{"data":"String"}/

This is not POST, this is GET. This kind of data has to go into the 
request body.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org