Skip to Content
0
Aug 04 at 02:09 PM

How to create or insert a data to oData Back-End

75 Views

Hi Experts,

I'm trying to insert data from back-end using oDataModel.create(), however I'm getting error:

HTTP request failed404,Not Found,{"error":{"code":"005056A509B11EE1B9A8FEC11C21D78E","message":{"lang":"en","value":"Resource not found for the segment 'Categories'."}

but my oDataModel.read() is working fine.

oDataModel.read("ClaimsSet", {
	success: function(oData, oResponse) {
		var oResults = oData.results;
		oModel.setData(oResults);
		oView.setModel(oModel);
		console.log('success');
	},
	error: function(oError) {
	        console.log(oError);
	}
});

here is my create/insert code.

var sPath = "/ClaimsSet";
var data = {
        CarrierId: "LKHE",
	TorId: "4000000099"
};

oDataModel.create(sPath, data, {
	success: function(oData, oResponse) {
		console.log(oResponse);
	},
        error: function(oError) {
		console.log(oError);
	}
});

Can anyone tell me why I'm getting error with my code create/insert?