pmcfernandes / web-api-for-raw-aql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.net Core Web API with raw SQL

Motivation

SQL for Web APIs: Examples, Benefits, and Implementation

Reasons

Because I have systems that store databases in remote locations and I do not intend to expose these databases on the internet, the best way is to build a WebAPI that allows raw SQL and at the same time allows other specific endpoints for different occasions.

Configuration

  • Change Connection String in appsettings.json
  • Change API limitations in Program.cs
    • Change Bearer to dynamic or make your own
    • Change IP of origin server or remove it if you don't need (Only accept requests from CLOUD api IP address in PROMISES web api)

Diagram of use

Diagram of use

Usage

@WebApplication_HostAddress = http://localhost:5187

POST {{WebApplication_HostAddress}}/api/sql
Accept: application/json

{
    "sql": "select * from users where iduser = @iduser",
    "args": {
        "iduser": 2
    }
}

###

About


Languages

Language:C# 100.0%