Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending JSON and another parameter in HTTPPost

 
Alex Armenteros
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edit: My way of sending the parameters was correct, on the browser the petition was a Get and the answer was different.

I need to do a POST call like this

http://url.com/endpoint?token=accessToken&action={"changePrice":"33"}

I've tried the url directly on a browser and it works

but doing this on a Java application behaves differently


I've tried encoding the entire URL and I get an error about the host not being blank.
I think the error is on the updates parameter only, but no clue where and why.

I know there are lots os similar cases, but those cases only send one parameter, the JSON, here I must send the JSON and the token separately

Librarys

Google-GSON 2.2.2
apache httpclient 4.2.3
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic