OData Queries

An OData query consists of a URI with three main segments:

<Service Base Address>/<Resource Path>?[<Query Options>]

Resource Path

The Resource Path specifies the resource to work with:

  • A collection of resources (e.g., all Service Requests)
  • A single resource (e.g., a Service Request with a specific key)
NoteNote

Collection names in the URL are case-sensitive.

Retrieve All Items in a Collection

GET http://myserver:5181/odata/ServiceRequests

Returns all Service Request items.
- For performance reasons, the number of returned items may be limited (Paging).


Retrieve a Single Resource by Key

Each entity has a key property defined as a UID (64-bit long, also called object id).

GET http://myserver:5181/odata/ServiceRequests(3101097999)

Returns the Service Request with UID 3101097999.


Query by ID Property

The key (UID) is not the same as the ID property some entities have.

To query a Service Request with ID = 1234, use the $filter clause:

GET http://myserver:5181/odata/ServiceRequests?$filter=ID eq 1234

Query Options

  • OData supports query string options to refine queries.
  • Each option begins with a dollar sign ($).
  • Multiple options are combined using an ampersand (&).

Examples of query options include filtering, ordering, and selecting specific fields.
They are described in more detail in the following chapters.

Back to top