cancel
Showing results for 
Search instead for 
Did you mean: 

How to make create call from SAPUI5 application for X-CSRF-Token enabled service

Former Member
0 Kudos

I have service hosted on SAP server, and GET call is working fine.

I need to do POST call using oModel.Create() call. Issue is that Create works in Rest client where i have to do a get with X-CSRF-Token and then i have to do POST using fetched token.

In UI5 app, read does not return any token, I read documentation and it said, oDataModel takes care of X-CSRF-Token.

I need help with sample code to see how oModel.create() can work in my case?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member203031
Contributor
0 Kudos

Hi Rohit,

To perform a create service i think no need of tokens,for example:

var json = {"name1","name2"}          //required json file to post

oModel.create("/entityset",json,null,function(success){

alert("success")

},

function(error){

alert("error")

}

);               //end of create

if this is not u r requirement please reply back.

Are you getting any error? please post the error.

Thanks,

Deepak Raj.