Skip to content

Automatic Multi-Table API

💡 TL;DR - Instant API, Related Data, Filtering, Sorting, Pagination, Swagger

The ApiLogicServer create command creates an API Logic Project that implements your API. No additional code is required. Custom App Dev is unblocked.

  • Endpoint for each table, with CRUD support - create, read, update and delete.

  • Filtering, sorting, pagination, including related data access, based on relationships in the models file (typically derived from foreign keys)

  • Automatic Swagger

  • Enforces logic and security - automatic partitioning of logic from (each) client app

  • Add new endpoints using standard Flask and SQLAlchemy - customize api/customize_api.py -

 

Declare / Customize API

APIs are:

  1. Declared in api/expose_api_models.py -- generated code which is typically not modified

  2. Customized in api/customize_api.py -- see below, and next page

API Declaration

 

Automatic Swagger Generation

API creation includes automatic swagger generation. Start the server, and open your Browser at localhost:5656.

Swagger

 

Self-Serve

Unlike Custom APIs which require server development, Self-Serve APIs can be used directly by consumers. They use Swagger to retrieve the data they want, then copying the URI to their code. API consumers include:

  • UI Developers - progress no longer blocked on custom server development

  • Application Integration - remote customers and organizations can similarly meet their own needs

For more information, see Self-Serve APIs.

 

Logic Enabled

API Logic Server is so-named because all the update APIs automatically enforce your business Logic.

Key Take-away: your API encapsulates your logic, factoring it out of APIs for greater concisenss and sharing / consistency

 

Examples

The Behave Tests provide several examples of using the API. You can review them here.

 

Key Usage: custom apps

The automatic Admin App is useful, but most systems will require custom User Interfaces. Use your favorite framework (eg, React).

 

ApiLogicServer curl

While swagger is the best way to explore your API, you may want to use curl during test cycles. If you have activated security, this fails since the header is not provided.

So, as of release 9.05.10, API Logic Server provides CLI commands for:

  1. login:
    • Gets a token from the server (it must must be running)
    • Stores it in api_logic_server_cli/api_logic_server_info.yaml
  2. curl:
    • Gets the saved token (so, you must login first)
    • Appends security headers to the curl command provided as arg #2

Swagger