openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

OData model V2 ServiceURL; does not allow additonal Url parameters to append for POST calls ?

Open ramana24 opened this issue 10 years ago • 2 comments

ODATA model v2 specification states that, addtional url parameters can be appended to serviceurl. API Refrence states: "sServiceUrl? :base uri of the service to request data from; additional URL parameters appended here will be appended to every request can be passed with the mParameters object as well: [mParameters.serviceUrl] A serviceURl is required!"

Steps to reproduce the problem:

when trying to pass url parameters as below, Odata model v2 it fails. This scenario was working fine until Odatamodel.v1 . oModel.create("/fnimportgetLog?edocumentId=" + "'" + edocumentId + "'", null, success: function(oData) {}, error: function(oError){} );

When trying OModel.create( POST) it is failing. I have attched screenshots showing working scenario while using V1 and same case failing on using V2. Could you help in fixing the issue? response specification v1_urlparamssupported v2_urlparamsignored app

What is the expected result? attached screenshot: Should append parameters to function import . What happens instead? attached screenshot: Does not append parameters to URL. this works fine until Odata model v1 issue is with odata model v2 alone. Any other information? (attach screenshot if possible) Specification screenshot , stating url parameters passing is as per standard .

ramana24 avatar Aug 09 '16 06:08 ramana24

Hello @ramana24 and thank you for reporting this issue. I will let the OData experts know so that they can follow up with you here.

Internally tracked as: #1680218370

Kind Regards, Michael

Michadelic avatar Aug 10 '16 06:08 Michadelic

Hello ramana24.

The ODataModel and the v2.ODataModel are not completely compatible regarding the API. Please check the API documentation:

https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.odata.v2.ODataModel.html#create

As for all CRUD methods you have to pass additional URL parameters via the parameters object. The first parameter should be a path. In your case a path to the collection where you want to create an entry.

myModel.create("/MyCollection", { urlParameters: {param1: "1", param2: "2"}});

BR, Jan

loginger avatar Aug 15 '16 10:08 loginger