skip to main content
Querying with OData Version 4 : Formulating queries with OData Version 4 : Fetching records and collections
  

Try Now

Fetching records and collections

As shown in the following table, use the plural entity name with the GET method to fetch metadata, a single entity, an entity's property, or a collection of entities. When using a data source group, prepend the entity name with the appropriate data source prefix. See URI conventions for addressing resources, entities, and related entities in Section 2 of the OData version 4 specification.
To fetch:
Method:
URI:
A single record
GET
<service_root>/<data_source_name>/<entity_singlar_name>
('<primary_key_value>')
Example:
https://myserver:8080/api/odata4/MySFDataSource/ACCOUNTS('1')
The value of a single field from a single record
GET
<service_root>/<data_source_name>/<entity_singlar_name>
('<primary_key_value>')/<column_name>/$value
Example:
https://myserver:8080/api/odata4/MySFDataSource/ACCOUNTS('1')/NAME/$value
A collection of records*
GET
<service_root>/<data_source_name>/<entity_plural_name>
Example:
https://myserver:8080/api/odata4/MySFDataSource/ACCOUNTS
A count of the records in a collection
GET
<service_root>/<data_source_name>/<entity_plural_name>/$count
Example:
https://myserver:8080/api/odata4/MySFDataSource/ACCOUNTS/$count
*A single request can only fetch one collection.