• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sending JSON and another parameter in HTTPPost

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic