Skip to content

JSON:API

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

  • You get an endpoint for each table, with CRUD support - create, read, update and delete.

  • The API also supports related data access, based on relationships in the models file (typically derived from foreign keys).

 

Key Take-away: instant rich APIs, with filtering, sorting, pagination, related data access and swagger. Custom App Dev is unblocked.

 

Automatic Swagger Generation

API creation includes automatic swagger generation.

Start the server, and open your Browser at localhost:5656. Or, explore the sample app running at PythonAnyWhere.

 

Provider-Defined vs. Consumer-Defined

JSON:APIs are interesting because they are Consumer-Defined, to reduce network traffic and minimize organizational dependencies.

Contrast these to Provider-Defined APIs. These can be simpler for interrnal users, whose needs can be determiend.

But for a wider class of consumers (e.g., business partenrs), providers typically cannot predict consumer needs. Consumers often resort to making multiple calls to obtain the data they need, or invoke APIs that return too much data. These can increase network traffic.

 

Swagger to construct API calls

Provider-defined API calls typically have more/longer arguments. To facilitate creating invoking APIs, use swagger to obtain the url.

Tip: use Swagger to debug your API parameters, then use the copy/paste services to use these in your application.

 

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).