Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3701

HTTP/1.1 422 Unprocessable Entity Error when sending data to LoopBack from Java client

$
0
0

I am doing an HttpPost to send data to LoopBack and get the response. I am getting an error as below from LoopBack :

HTTP/1.1 422 Unprocessable Entity [X-Powered-By: Express, Vary: Origin, Accept-Encoding, Access-Control-Allow-Credentials: true, Content-Type: application/json; charset=utf-8, Content-Length: 1528, Date: Thu, 18 Dec 2014 18:13:45 GMT, Connection: keep-alive]

So, what I did in java is created a json from a java object , when I used this JSON in loopback api explorer, the data was inserted and gave me response 200, but doing from Java, I am getting this error. Does anyone have an idea about this.Java code is as below

 JSONObject json = new JSONObject(jsonString); StringEntity stringEntity = new StringEntity(json.toString()); HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(POST_CLAIM_URL); post.setEntity(stringEntity); HttpResponse httpResponse = null; httpResponse = client.execute(post);

I had make sure , I am not adding a duplicate entry.

Regards,Varun


Viewing all articles
Browse latest Browse all 3701

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>