Ask Your Question

My code is trying to stop a running Vm.Geeting Error Response {"badRequest": {"message": "Malformed request body", "code": 400}}

asked 2015-12-28 04:15:20 -0500 gravatar image

HttpPost request = new HttpPost(url); request.addHeader("Accept", "application/json"); request.setHeader("Content-Type", "application/json"); request.setHeader("X-Auth-Token",token); String request="{\"os-stop\": null}";

        StringEntity se = null;
        se=new StringEntity(gson.toJson(requestBody));

        HttpResponse response=client.execute(request);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-12-29 00:18:31 -0500 gravatar image

Resloved the issue by replacing

se=new StringEntity(gson.toJson(requestBody).replaceAll("\\", "").replaceAll("^\"|\"$", ""));


edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-12-28 04:15:20 -0500

Seen: 154 times

Last updated: Dec 29 '15