You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Madhawa Kasun Gunasekara <ma...@gmail.com> on 2016/08/27 18:23:11 UTC

Does Key-predicate (Entity-ID) is must for creating entities in OData v4?

Hi All,

Can anyone give me a concrete answer for the $subject, please?
[1] in this request I couldn't see the key predicate (Entity-ID). but when
I see in the protocol specification [2], I can see the key predicate in the
request payload.

What is the correct one? Or can we use both?

[1] http://www.odata.org/getting-started/basic-tutorial/#modifyData

[2]
http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html#_Toc453752299

Thanks,
Madhawa

RE: Does Key-predicate (Entity-ID) is must for creating entities in OData v4?

Posted by "Grande, Oliver" <ol...@sap.com>.
Hello Madhawa,

I like to add the following to Ramesh reply.
You can have a look at the metadata<http://services.odata.org/V4/(S(4srnenhvvb2ywwjzeyha5f3t))/TripPinServiceRW/$metadata> of the serve the example. There you can find that the user name is the key  of Entity Type Person:

<EntityType Name="Person" OpenType="true">
<Key><PropertyRef Name="UserName"/></Key>
...

So also the example has the key predicate ("UserName": "teresa") within the payload.

I like to point out that the following:

Properties computed by the service (annotated with the term Core.Computed, see [OData-VocCore]<http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html#VocCore>) and properties that are tied to properties of the principal entity by a referential constraint, can be omitted and MUST be ignored if included in the request.

Also holds true for the key. If e.g. a UUID is used as key, which is created on server side, you do not need to provide it in the payload. This is also the reason way the response has to contain the Location header, this is especially important if the request contains the Preference return=minimal header.

Regards,
Oliver


From: Ramesh Reddy [mailto:rareddy@redhat.com]
Sent: Mittwoch, 31. August 2016 15:10
To: Madhawa Kasun Gunasekara <ma...@gmail.com>
Cc: user@olingo.apache.org
Subject: Re: Does Key-predicate (Entity-ID) is must for creating entities in OData v4?

Rule 1, when in doubt always fallback on the specification than any examples any where.

Now coming to the question, can you clarify where in spec do you see the entity-id requirement? The link you provided starts with

"To create an entity in a collection, the client sends a POST request to that collection's URL."


The response is the one coming back with Location header, which will have identifying URL about the entity.


Ramesh..


________________________________
Any update on this ?

Madhawa

On Sat, Aug 27, 2016 at 11:53 PM, Madhawa Kasun Gunasekara <ma...@gmail.com>> wrote:
Hi All,

Can anyone give me a concrete answer for the $subject, please?
[1] in this request I couldn't see the key predicate (Entity-ID). but when I see in the protocol specification [2], I can see the key predicate in the request payload.

What is the correct one? Or can we use both?

[1] http://www.odata.org/getting-started/basic-tutorial/#modifyData

[2] http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html#_Toc453752299

Thanks,
Madhawa



Re: Does Key-predicate (Entity-ID) is must for creating entities in OData v4?

Posted by Ramesh Reddy <ra...@redhat.com>.
Rule 1, when in doubt always fallback on the specification than any examples any where. 

Now coming to the question, can you clarify where in spec do you see the entity-id requirement? The link you provided starts with 

"T o create an entity in a collection, the client sends a POST request to that collection's URL." 

The response is the one coming back with Location header, which will have identifying URL about the entity. 

Ramesh.. 

----- Original Message -----

> Any update on this ?

> Madhawa

> On Sat, Aug 27, 2016 at 11:53 PM, Madhawa Kasun Gunasekara <
> madhawa30@gmail.com > wrote:

> > Hi All,
> 

> > Can anyone give me a concrete answer for the $subject, please?
> 
> > [1] in this request I couldn't see the key predicate (Entity-ID). but when
> > I
> > see in the protocol specification [2], I can see the key predicate in the
> > request payload.
> 

> > What is the correct one? Or can we use both?
> 

> > [1] http://www.odata.org/getting-started/basic-tutorial/#modifyData
> 

> > [2]
> > http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html#_Toc453752299
> 

> > Thanks,
> 
> > Madhawa
> 

Re: Does Key-predicate (Entity-ID) is must for creating entities in OData v4?

Posted by Madhawa Kasun Gunasekara <ma...@gmail.com>.
Any update on this ?

Madhawa

On Sat, Aug 27, 2016 at 11:53 PM, Madhawa Kasun Gunasekara <
madhawa30@gmail.com> wrote:

> Hi All,
>
> Can anyone give me a concrete answer for the $subject, please?
> [1] in this request I couldn't see the key predicate (Entity-ID). but when
> I see in the protocol specification [2], I can see the key predicate in the
> request payload.
>
> What is the correct one? Or can we use both?
>
> [1] http://www.odata.org/getting-started/basic-tutorial/#modifyData
>
> [2] http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/comp
> lete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-
> complete.html#_Toc453752299
>
> Thanks,
> Madhawa
>