cancel
Showing results for 
Search instead for 
Did you mean: 

Error processing request stream. JSON text specified is not valid | XSOData

Former Member
0 Kudos

I am able to do a post with the XSODATA via postman client, however it wont work in the SAPUI5 application.

below is from postman.

Below is my code. I am using sap.ui.model.odata.ODataModel

with content-type" : "application/json;charset=utf-8"});

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Pass the JSON object as a variable to make sure it is in the right format.

var oEntry = {}; 
oEntry.perno = "123456789";
oEntry.SID = "BHAT";
oEntry.tdate = "Apr 018";
oEntry.vecnumber = "Ino3x";

sap.ui.getCore().getModel().create('/Mileage', oEntry, null, 
   function (oResponse){
       console.log("Create successful");
       console.log(oResponse);
   },
   function (oError) {
       console.log("Create failed");
       console.log(oError); 
    }
);