Data APIs
Generate REST APIs automatically from databases
Data APIs generate REST APIs directly from your databases. You don’t need to write backend code just to expose a table.
Overview
You can point the platform at an existing database, and it will generate an API. Supported databases include:
- PostgreSQL
- MySQL
- SQL Server
- ODBC
- Oracle
Features
- Auto-generated endpoints
- Built-in OpenAPI documentation
- Standard query support (filtering, sorting, and pagination)
- Direct integration with API subscriptions for access control
Creating Data APIs
You can create a Data API through the interface. You pick your database type, provide connection details, set the route, and choose how to authenticate.
Configuration Example
apiVersion: weikio/v1
kind: OpenApiEndpoint
metadata:
name: sql-customers
spec:
apiName: Weikio.ApiFramework.Plugins.SqlServer
apiVersion: 1.0.0
route: /api/v1/customers
configuration:
connectionString: "Server=localhost;Database=Customers;Trusted_Connection=True;"
Note: The kind is currently OpenApiEndpoint, but we plan to rename it to DataApi in a future release.
Authentication
If you need to lock down a Data API, use an ApiSubscription:
apiVersion: weik.io/v1alpha1
kind: ApiSubscription
metadata:
name: data-api-access
spec:
apis:
- sql-customers
isActive: true
parameters:
key: "your-api-key"
Practical Uses
I mostly see this used in a few specific scenarios:
- Exposing a legacy database as a REST API without writing a middleware layer
- Giving a mobile app a quick data backend
- Throwing together an internal dashboard quickly
What’s Next
- API Management Overview - Learn more about APIM
- Subscriptions - Restrict access
- Using Variables - Keep connection strings out of plain text