janhommes / o.js

o.js - client side oData lib.
https://janhommes.github.io/o.js/example/
MIT License
238 stars 57 forks source link

How do I build a query to get related entities? #31

Closed jlkalberer closed 5 years ago

jlkalberer commented 8 years ago

So I don't want to use $expand. I want to run a query that returns only the related entity or related entities of something. I think this is part of the OData 4 spec...

So I want to run something like this - http://services.odata.org/V4/OData/OData.svc/Products(4)/People

Where People would be all the people who bought Product with the ID 4.

Is this possible with the o.js api?

janhommes commented 8 years ago

Mh, I think that is not possible right now. We need to implement it. Can you give us an link to the odata-specs, that we can give it the correct name?

jlkalberer commented 8 years ago

There is also the ability to call server functions (operations) that is similar to this feature.

If you look at section 2 it talks about relationships and a navigation link. Here is more on the spec

It's pretty hard to find good info on any of this anyways...

If you guys don't add this feature I fork and take it on. That's quite a ways off and we'll see how if the product needs it.

be236 commented 6 years ago

Also, can you add support for $entity and $id, as shown in the OData v4 Specs:

11.2.8 Resolving an Entity-Id To resolve an entity-id, e.g. obtained in an entity reference, into a representation of the identified entity, the client issues a GET request to the $entity resource which located at the URL $entity relative to the service root. The entity-id MUST be specified using the system query option $id. Example 62: return the entity representation for a given entity-id http://host/service/$entity?$id=http://host/service/Products(0) A type segment following the $entity resource casts the resource to the specified type. If the identified entity is not of the specified type, or a type derived from the specified type, the service returns 404 Not Found.

And if you can update your README docs in this Repo and the summary lines in o.js file, that would be great too.

be236 commented 6 years ago

Also, can you add support for $skiptoken query option?

janhommes commented 5 years ago

83