cancel
Showing results for 
Search instead for 
Did you mean: 

Why am i getting an error 405 when i am trying to PUT using batch?PUT without batch works fine.

Former Member
0 Kudos
onSave: function() { 


 var oDataModel = new sap.ui.model.odata.ODataModel(serviceurl); 
 oDataModel.setUseBatch(true); 
 if (Flag) { 
 oDataModel.setHeaders({ "If-Match": "*" }); 
	oDataModel.update("/entitySet('" + clnt + "')", updateRecord, null, 
	function(oData, oResponse) 
	{ 
 
	},
	function(oError) { 


	} 
 else 
  { 


 	oDataModel.create("/entitySet", createRecord, null, 
	function(oData, oResponse) { 




 	}, 
	function(oError) { 


	});


  }
}

please note that
1. I am using setUseBatch(true) to enable batch request.
2. PUT and POST works without batch.
3. POST works with batch (No issues) but PUT doesnt work 
4. My odata service was generated using a BCO.(so create update methods were auto generated)

The error is 
405 method not allowed
The specified HTTP method is not allowed for the resource identified by the Data Service Request URI
Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Did you already try BATCH in a REST client? Can you share its screenshot and payload content?

Regards,

JK

Former Member
0 Kudos

Hi this is my payload. Thanks for the reply 🙂 Please help me as the issue is not solved yet

Accepted Solutions (0)

Answers (1)

Answers (1)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

URL for batch should be like: http(s)://smpserver:port/appid/$batch

can you look at last comment mentioned in this thread? https://archive.sap.com/discussions/thread/3852595

try with --changeset only

Regards,

JK

Former Member
0 Kudos

Thank you so much for your time 🙂 I have solved the issue. The problem was actually because of etags and if-match header.