Giter Club home page Giter Club logo

sql-odata's Introduction

oData Integration

Overview

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.

Docs

Crud Operations

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.

Query Options (GET)

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.

Enpoints

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') ).

Examples

$metadata

GET: {{host}}/v2/$metadata

GET - query:

{{host}}/v2/Movies

{{host}}/v2/Movies?$filter=title eq 'asd'&$select=title

$expand: {{host}}/v2/Movies?$expand=Quotes Coming soon...

GET - read:

{{host}}/v2/Movies('0')

Association: {{host}}/v2/Movies('0')/Quotes

POST - create:

{{host}}/v2/Movies

Coming soon...

PUT - update:

{{host}}/v2/Movies('0')

Coming soon...

DELETE - delete:

{{host}}/v2/Movies('0')

Coming soon...

Platformatic DB API

This is a generated Platformatic DB application.

Requirements

Platformatic supports macOS, Linux and Windows (WSL recommended). You'll need to have Node.js >= v18.8.0 or >= v20.6.0

Setup

  1. Install dependencies:
npm install
  1. Apply migrations:
npm run migrate

Usage

Run the API with:

npm start

Explore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.