Hi all, I'm trying to implement Create operation.
I do well with getting scrf-token, but the request with json data failed to send.
OData.request ({ requestUri:"***/sap/opu/odata/sap/Z_SY_FD_SRV/ZFIORITESTSet('0001')", method: "GET", headers: { "X-Requested-With": "XMLHttpRequest", "Content-Type": "application/JSON", "DataServiceVersion": "2.0", "X-CSRF-Token":"fetch" } }, function (data, response) { header_xcsrf_token = response.headers['x-csrf-token']; alert(header_xcsrf_token); OData.request ({ requestUri:"*****/sap/opu/odata/sap/Z_SY_FD_SRV/ZFIORITESTSet", method: "POST", headers: { "X-Requested-With": "XMLHttpRequest", "Content-Type": "application/JSON", "DataServiceVersion": "2.0", "Accept": "application/atom+xml,application/atomsvc+xml,application/xml", "X-CSRF-Token": header_xcsrf_token, }, data: { Userid:userId_var, Phone:phone_var, } },
With postman the request can be sent to the server.
Please help me with it.
Thanks.