Hello
OData.request
({
requestUri:
"proxy/http/cors-anywhere.herokuapp.com/XXXX:8081/com.sap.elogbook/BYPASS",
method: "GET",
headers:
{
"X-SMP-APPCID": "b5c4d3c6-1745-4d53-9465-91a8fc2c53f9",
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token":"Fetch"
}
},
function (data, response)
{
var header_xcsrf_token = response.headers['X-CSRF-TOKEN'];
//var cookie = response.headers['Set-Cookie'];
OData.request
({
requestUri:
"proxy/http/cors-anywhere.herokuapp.com/XXXX:8081/com.sap.elogbook/BYPASS",
method: "POST",
headers: {
"X-SMP-APPCID": " b5c4d3c6-1745-4d53-9465-91a8fc2c53f9",
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"Accept": "application/atom+xml,application/atomsvc+xml,application/xml",
"X-CSRF-Token": header_xcsrf_token
},
data:
{
LOGNO: "66",
BYPASSNAME: "PANARA",
DATE: "2016-02-02",
UNIT: "3",
STATUS: "inservice",
TIME: "02:02:00",
LOCATIONID: "1",
CREATED_DATE: "3016-02-02 00:00:00.0",
UPDATED_DATE: "2016-03-03 00:00:00.0",
CREATED_BY: "AAA",
UPDATED_BY: "BBB"
}
},
function (data, response)
{
$("<div>Returned data " + window.JSON.stringify(data) + "</div>").appendTo($("#MessageDiv"));
},
function (err)
{
$("<div>Returned error " + window.JSON.stringify(err.response) + "</div>").appendTo($("#MessageDiv"));
}
);
},
function (err)
{
var request = err.request; // the request that was sent.
var response = err.response; // the response that was received.
alert("Error in Get -- Request "+request+" Response "+response);
}
);
I can get data success throw this URL but POST give 403 forbidden. Can you please help me in eclipse code.