Skip to content

Mocking an OData service

Right-click a folder ▸ Add ▸ OData server.

FieldRole
Mock metadataThe CSDL document, served as it is on $metadata
Mock dataA JSON object: entity set name → array of objects

An OData server item: the service root's address, the CSDL $metadata document served verbatim, and the mocked entity data per entity set

This is the point that sets this server apart from simply returning frozen JSON: Restorm applies the system options to your mock data.

A client calling:

GET localhost:8080/Clients?$filter=pays eq 'FR'&$select=id,nom&$top=10&$count=true

gets a result that really is filtered, projected, truncated and counted.

The options supported: $filter, $select, $orderby, $top, $skip, $count, $expand and $batch.

Developing against an OData service before it exists, or reproducing a precise data set for a test — without standing up a full OData server, which is rarely a pleasant afternoon.

Since the $metadata document is served as it is, client tools (Restorm’s own OData import included) can discover the service as normal.

The OData server and OData server close actions. See Hosted servers.