Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Client API call for POST method

 
Kush Tehlan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to make a post request with json data in raw body format. I tried StringEntity, NameValuePair, ByteArrayCode, all are not able to pass the input.

My inout is=

{
"Id":"90392",

"ticketId":{"95794":"2"}
}



Don't know where i am wrong. Can someone help me out
 
Ron McLeod
Bartender
Pie
Posts: 1049
65
Android Eclipse IDE Java Linux MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you are expecting to get content back from the server in response to your POST operation.  Maybe no content was returned.

   - Check the response status is one which would include there is content (should be a 200, maybe 206 as well).
   - Check that the Content-Length header is present and it indicates a non-zero length.
 
Kush Tehlan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting 400 BAD request. It gives an error, it not able to pass json what i am sending. It send an error saying that "id" and "clientId" is required. I am trying my best don't know what i am missing.
 
Paul Clapham
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kush Tehlan wrote:It send an error saying that "id" and "clientId" is required.


Well, I don't see any code which passes those parameters, whether as JSON or in some other way. Are you sure you have implemented the requirements for that URL correctly?
 
Kush Tehlan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Paul Clapham

Yeah i have checked through postman, the same thing i am passing over there and it's working fine. By mistake i wrote id and clientid... in actually it gives me reply

  {"response":{"messages":[["The eventId is required","The ticketArray is required"]]}}


which i am passing. Also i have to send body in" format only. I tried that too, but same error message
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic