on 12-21-2016 12:01 PM
Hello,
i made some requests using xsjs, calling external webservices, but now I need to call and pass the params in the request body, not in the url as i have been doing.
So, i need to generate this exact call, which i now it works i postman
here is my code, wich does not work.
var res;
var response;
var dest = $.net.http.readDestination(destination_package, destination_name);
var client = new $.net.http.Client();
var req = new $.web.WebRequest($.net.http.POST, "upload_file");
//var req = new $.net.http.Request($.net.http.POST, "upload_file");
req.setBody(JSON.stringify({
action:"upload_file",
id: id,
filename: filename,
extension: extension,
checksum: checksum,
type_id: typeId,
the_file: theFile,
user_id: userId
}));
client.request(req, dest);
response = client.getResponse();
res = response.body.asString();
So, i must be missing something, but I don't know what. I tryed with $.net.http.Request instead of $.web.WebRequest but the result is the same.
Please, any help would be appreciated.
Thank you
Hello Luis - am looking to make an exact similar call. Please can you share if and how you fixed this.
Thanks
Sudarshan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.