This is an API based on CRUD operations with Basic authentication. It uses most of AppGini functions and works with any AppGini's generated applications. It provides GET, POST, PUT, PATCH and DELETE support and all responses are in JSON format. Only Admin users can use this API.
The v2 was first designed to integrate AppGini with Microsoft's Power BI, so its function is READ-only with GET/POST suport. The v3 its a full CRUD API. Custom operations are coming soon.
On startup, the API class:
- Includes the
lib.phpfile of AppGini on startup, so it can use the AppGini functions. - Fetches the tables and columns of the application from
INFORMATION_SCHEMA, so it's always up to date with your app. - Fetches a list of Admin users of your application.
- Validates the authentication provided by the user.
- If it's ok, get the request and do the query
- Returns data in JSON format.
- Put the
apifolder on your app's root folder - Enjoy your API :)
Both GET and POST use the same endpoints.
GET: /api/v2/index.php?tb=your-db-tablePOST:
{
"tb": "your-db-table"
}More examples on the wiki.
GET: /api/v3/index.php?read=your-db-tablePOST:
{
"create": "your-db-table",
"info": {
"field": "value",
...
}
}PUT/PATCH:
{
"update": "your-db-table",
"id": 123
"info": {
"field": "value",
...
}
}DELETE:
{
"delete": "your-db-table",
"id": 123
}