cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the param values in the URL in the data provider class

naseemvp007
Participant
0 Kudos

Hi,

If i give the following URL with a PUT request.

<hostname>:<port><serviceroot>DocItemSet(DocItemID='1003',DocItemID='001')?Quantity='20.00'

At backend, inside the data provider class UPDATE_ENTITY method, how can i retrieve the value entered by the user for 'Quantity' as entered as parameter in the URL.

Thanks & Regards,

Naseem

Accepted Solutions (1)

Accepted Solutions (1)

RalfHandl
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Naseem,

What do you want to achieve with this query?

If Quantity is a property of a DocItem that you want to update, you can do that with a PATCH request that provides the values of the properties to change as a JSON object:

PATCH <hostname>:<port><serviceroot>DocItemSet(DocID='1003',DocItemID='001') HTTP/1.1

Content-Type: application/json

{"Quantity":20.00}

Hope this helps!

--Ralf

kammaje_cis
Active Contributor
0 Kudos

Hi Ralf,

I see that PATCH can always replace PUT(Patch all entity properties). So can we always use PATCH? Is there any disadvantage of PATCH compared to PUT?

Thanks

Krishna

naseemvp007
Participant
0 Kudos

Hi Ralf,

Thanks for the reply.

To make it simple,

my requirement was to update the quantity field of the DocItemSet(DocID='1003',DocItemID='001').

so i was  thinking whether i can send a PUT request without any payload since it was only one property update.

Is it possible to send a PUT request without payload?

Also please tell me how to access the value passed as in this request for 'Quantity' in the data provider class.

(DocItemID='1003',DocItemID='001')?Quantity='20.00'.

Is it possible to access which as passed as params?

Thanks & Regards,

Naseem

RalfHandl
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Krishna,

I'm not aware of any disadvantage of PATCH, in fact PATCH has some advantages as you only have to send the changed fields over the wire.

Regards!

--Ralf

RalfHandl
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Naseem,

you can't use PUT without a payload, and you can't access non-standard query options.

Using non-standard query options has the disadvantage of making your service unusable for standard OData clients, and for developers that haven't been educated by you in how to use these non-standard query options.

Regards!
--Ralf

Answers (0)