In this post, you will learn more about OData service URIs.

This is a post from a series Building OData Services. Earlier posts can be accessed at below links.

  1. Building OData Services [1] : OData Overview
  2. Building OData Services [2] : Understanding OData Service
  3. Building OData Services [3] : Create OData Service
  4. Building OData Services [4] : Register and Test OData Service

To work with OData it is very important to understand the URI options that can be used.

Summary of all URI Options

To demonstrate the options, Northwind service is used. This service was first introduced in OData Overview post where we looked at the metadata.

URL for the service :

The below additions should be added after

Metadata/$metadataShows metadata for the service
Entity Set/Customers
Get all records for the entity
Entity Set Count/Customers/$count
Get count of records in a entity set
Single Entity/Customers(‘ALFKI’)
Get single entity record based on entity keys.For single key, it is not mandatory to mention the key name
Displays associated entity sets recordsNote , separated keys
In-lining/Customers(‘ALFKI’)?$expand=OrdersShows data for principal entity and associated entity together
Filter/Customers?$filter=City eq ‘London’ and Country eq ‘UK’Used to filter the entity set records based on any property
Search String/Customers?search=’109′Pass the search string which can be used to filter the data
Select/Customers?$select=ContactName,City,CountrySelect only specific fields
Filter and Select/Customers?$filter=City eq ‘London’ &$select=ContactName,City,CountryTo combine multiple options & can be used
Top and Skip/Customers?$top=2&$skip=5Top tells how many records to fetchSkip tells how many records to skip from the first recordTogether these help with displaying contents page by page
/Customers?$orderby=Country desc,City asc
Sorts the result by properties in Ascending (asc) or descending (desc) order. default is ascending
Function Import/GetFlightNumbers?CarrierID=’AA’GetCarrierFlights is name of the function import and Carrid is the importing parameter. ***This is an example and does not work with Northwind service.
$format=json/Customers?$format=jsonTo get the data in json format
OData URI Options

Now, let us look at each URL more closely.



Shows metadata for the service. From the metadata you can understand the structure of the service. Metadata is a large document with information on all the Entity Types, Entity Sets, Associations etc.

Entity Set

Get all records for the entity.


Another URL that can be checked is –

Entity Set Count


This gives number of records in entity set.

Single Entity


As this Entity Type has single field as a key, it is not needed to mention the key name.


Here, we need to mention the key names and values separated by comma (,) .



This means get all Orders for Customer entity with key ‘ALFKI’. This is one to many association.


This is one to one association where Product details for a product from the selected Order_Detail entity are shown.

Similarly rest of the URLs can be tested.

Function Import


This is not available in Northwind service. This is an example created to depict how the function import is called. Here, GetFlightNumbers is the name of the Function Import and ‘AA’ is passed to the parameter CarrierID.

Next post – Building OData Services [6] : Implementing all URIs has all the information and code samples required for implementing these URIs.

Visit OData Development in SAP to explore all articles on OData.

If you like the content, please subscribe…

Join 4,024 other subscribers

Discovering ABAP YouTube Channel