HTTP Status code = 400

2019-09-01 04:30发布

问题:

I am currently doing a Rest call with the jasper rest api and I have this response :

trailers: {},
  readable: false,
  url: '',
  method: null,
  statusCode: 400,
  client: 

So this is a bad request

Bad request 400

The request had bad syntax or was inherently impossible to be satisfied. 

And here is my nodejs request with request module :

var request = require("request");

request.post({url: "http://localhost:8080/jasperserver/rest/login", qs:     {j_username:"jasperadmin", j_password: "jasperadmin"}}, function(err) {
if(err) {
    return console.error(err);
}


    request.put("http://localhost:8080/jasperserver/rest/report/reports/samples/AllAccounts", function(err, res, body) {
        if(err) {
            return console.error(err);
        }
        console.log("Response ",res);



});

});

And here is the doc for jasperserver api : http://www.scribd.com/doc/68405255/2/REST-Web-Services#page=30

Thanks