skip to main content
Querying with OData Version 4 : Getting started with OData Version 4 : Requesting service metadata and the service document

Try Now

Requesting service metadata and the service document

Metadata for your OData service can be fetched by requesting the service document or service metadata using a GET request.

Service Document

The service document returns a list of all the available entities in a schema in the request payload. To fetch the service document, issue a GET request for the data source's service root:
For example:

Service Metadata

Fetching service metadata returns a description of the data model for the service, including the names, properties, data types, and relationships for all entities in the schema. To fetch service metadata, issue a GET request for the data source's service root with /$metadata appended to the path:
For example:
You can use the odata.metadata parameter in the Accept header to determine the level of control information returned for $metadata requests. For example:
GET https://MyServer:8443/api/odata4/myds/$metadata
OData-Version: 4.0
Content-Type: application/json;odata.metadata=full
Accept: application/json
The level of information returned can be set to full, minimal, or none, depending on the needs of your application. full provides the most annotations, but at greater expense to the wire, while none returns the fewest at the least expense. The following table provides a list of the required annotations returned by level.
Table 146. odata.metadata Levels
Annotations Returned
minimal (default)