Hello Colleagues,
I am trying to modify file content and activate it by using and xsjs and the XS REST API. For this purpose I am using the HTTP Outbound API and after making the http request, the response is always an http code 303 with HANA login URL as "location" parameter.
I am sending into the header the CSRF token but it seems it is not enough for authentication.
My real question is: How can I give to the request the proper credentials? Is there something that I am doing wrong?
Here is a piece of the code:
var client = new $.net.http.Client();
var oSapBackPack = { 'Active': 'true' };
var sapBackPack = JSON.stringify(oSapBackPack);
var dest = $.net.http.readDestination("MyProject.services", "XS_REST_API");
var CSRF = $.session.getSecurityToken();
var request = new $.web.WebRequest($.net.http.GET, "");
// Header parameters
request.headers.set("Orion-Version", "1.0");
request.headers.set("X-CSRF-Token", CSRF);
request.headers.set("SapBackPack", sapBackPack);
client.request(request, dest);
var response = client.getResponse();
return response.body.asString();
Path in XS_REST_API.httpdest:
pathPrefix = "/sap/hana/xs/dt/base/file/MyProject/test_rest_api.txt";