on 06-22-2017 12:54 AM
Hi ,
I have created an app in web ide tool and trying to POST data from app to gateway odata service. I am facing and error 415 (Unsupported Media Type). This is happening due to content type. I have declared the content type in manifest
"headers": {"X-Requested-With": "X","Content-Type": "application/json; charset=utf-8"},
same header i have set while calling create function
var oEntry ={"Matnr" : "100005","Werks" : "X110","Name1" : "PLANT XXXXX","Labst" : "0.000","Insme" : "1134.000","Speme" : "0.000","Meins" : "BOX","Maktx" : "XXXXXX MILLED PLAIN BOX"};
var oModel = this.getOwnerComponent().getModel("Model declared in manifest");
oModel.refreshSecurityToken(function(){
console.log('Succesfully retrieved CSRF Token');},function(){
console.log('Error retrieving CSRF Token');}, false);
oModel.setHeaders({"X-Requested-With": "X","Content-Type": "application/json","accept": "application/json"});
oModel.create("/Entityet", oEntry,{method:"POST",
success:function(data){
alert("success");},
error:function(e){
alert("error");}});
error in chrome
when i put a trace on odata and replay it Content Type is coming as application/x-www-form-urlencoded; charset=UTF-8 instead of application/json.
Not sure what i am missing in the code.
error is 415 unsupprted media type. please help
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.