Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

rafinhacarneiro/appgini-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

AppGini API [DEPRECATED]

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.

How does it work?

On startup, the API class:

  • Includes the lib.php file 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.

Installation

  1. Put the api folder on your app's root folder
  2. Enjoy your API :)

Basic usage

v2

Both GET and POST use the same endpoints.

  • GET: /api/v2/index.php?tb=your-db-table
  • POST:
{
  "tb": "your-db-table"
}

More examples on the wiki.

v3

  • GET: /api/v3/index.php?read=your-db-table
  • POST:
{
  "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
}