oData is a RESTful API standard protocol for querying and updating data. It is a standard that is used by many enterprise applications and is supported by many platforms.
This integration provides a RESTful API that is compatible with the oData standard. It is a wrapper around the Platformatic DB API.
In oData Service the crud operations are mapped to the following HTTP methods:
HTTP Method | oData Operation | Description |
---|---|---|
GET | Query | Retrieves the collection of resources consistent with the query options present in the URL (array). |
GET | Read | Retrieves a single resource from the keys provided (object). |
POST | Create | Creates a new resource. |
PUT | Update | Updates an existing resource. |
DELETE | Delete | Deletes an existing resource from the keys provided. |
oData query options are provided as query parameters in the URL.
Query Option | Description |
---|---|
$filter | Filters the collection of resources based on a Boolean condition. |
$select | Selects a subset of properties from each resource. |
$expand | Expands related entities inline. |
$orderby | Sorts the collection of resources in ascending or descending order based on one or more properties. |
$top | Returns only the first n resources in the collection. |
$skip | Skips the first n resources in the collection. |
$count | Returns the total count of resources in the collection. |
!!! the query options are permitter in the GET method only.
Crud Operation | HTTP Method | Endpoint | Description |
---|---|---|---|
Query | GET | /odata/{entity} | Retrieves the collection of resources consistent with the query options present in the URL (array). |
Read | GET | /odata/{entity}({key}) | Retrieves a single resource the keys provided (object). |
Create | POST | /odata/{entity} | Creates a new resource. |
Update | PUT | /odata/{entity}({key}) | Updates an existing resource. |
Delete | DELETE | /odata/{entity}({key}) | Deletes an existing resource. |
!!! {entity} rappresent the name of the entity, {key} rappresent the key of the entity. In case of multiple keys, the keys are separated by comma (eg. {entity}(Id='3',Name='salvatore') ).
GET: {{host}}/v2/$metadata
{{host}}/v2/Movies
{{host}}/v2/Movies?$filter=title eq 'asd'&$select=title
$expand: {{host}}/v2/Movies?$expand=Quotes
Coming soon...
{{host}}/v2/Movies('0')
Association: {{host}}/v2/Movies('0')/Quotes
{{host}}/v2/Movies
Coming soon...
{{host}}/v2/Movies('0')
Coming soon...
{{host}}/v2/Movies('0')
Coming soon...
This is a generated Platformatic DB application.
Platformatic supports macOS, Linux and Windows (WSL recommended). You'll need to have Node.js >= v18.8.0 or >= v20.6.0
- Install dependencies:
npm install
- Apply migrations:
npm run migrate
Run the API with:
npm start
- โก The Platformatic DB server is running at http://localhost:3042/
- ๐ View the REST API's Swagger documentation at http://localhost:3042/documentation/
- ๐ Try out the GraphiQL web UI at http://localhost:3042/graphiql
- !!! The oData API is available at http://localhost:3042/odata