Reading Data from OData Services
With OData services you not only can access OData actions, but also read and use the data of entity sets exposed via OData services.
-
getEntity: for retrieving a single OData entity from an entity set, by specifying the key to the entity. This is similar to selecting a single row from a SQL table via SELECT * FROM T1 WHERE ID = <id>.
-
getEntitiesFromEntitySet: for retrieving all entities from an OData entity set. This is similar to SELECT TOP <N> * FROM T1. With this API you can use the OData system query options filter, orderby, select, count, top and skip.Note
The number of entities is limited to 1000 if no system query options have been used. If system query options are set, the number of retrieved entities is not limited, unless you set a value for the system query option top. top.
-
getEntitiesCountFromEntitySet: for retrieving the number of entities from an OData entity set. This API works like the getEntitiesFromEntitySet API and you can also use the OData system query options filter, orderby, select, count, top and skip.
// returns a list of entities, filtered by the given system query option(s) ODataService_1.getEntitiesFromEntitySet("Departments", {filter: "contains(Sector,'Consulting')", orderby: "Sector asc" }); // returns a list of entities, not filtered ODataService_1.getEntitiesFromEntitySet("Equipments"); // returns the number of entities in the entity set "TEAMS" ODataService_2.getEntitiesCountFromEntitySet("TEAMS"); // returns the number of entities in the entity set "EMPLOYEES", filtered by the given system query option(s) ODataService_2.getEntitiesCountFromEntitySet("EMPLOYEES", {skip: 5, top: 10});
-
chaining from one entity set to another is not supported
-
expand (analogous to joining) is not supported
-
entity sets with parameters are not supported
-
entity sets with mandatory filters are not supported