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

Try Now

Fetching records and collections with OData version 2

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 3 of the OData 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/odata/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/odata/MySFDataSource/ACCOUNTS('1')/NAME/$value
A collection of records*
GET
<service_root>/<data_source_name>/<entity_plural_name>
Example: https://myserver:8080/api/odata/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/odata/MySFDataSource/ACCOUNTS/$count
*A single request can only fetch one collection.