Skip to content

API Design

Rick van der Zwet edited this page Jun 19, 2023 · 1 revision

Intro

NOTE: Work in process, documentation might not reflect latest changes or all available features #930

This documentation aims as an developer guidance point APIv2 development. For user/development documentation on the current API see Server API documentation (PDF) and User API documentation (PDF).

Code entry points

Design principles

  • Database model is represented by /v2/api/UI/
  • Helper function is represented by /v2/api/Helper/<Name
  • Adaptation and Migration should follow an natural path for the user. Thus the 'APIv1' and APIv2' will exists next to each-other. No database models are changed, until the old API is deprecated-and-removed.

Code implementation

Abstract BaseAPI

  • AbstractBaseAPI contains shared logic and dictated required API call required to implement.
  • Type checking of input upfront to allow for better error messages on incorrect data input.
  • Authentication is done via username/password login to request an 'token'. Tokens are valid for a specific set of time.
    • TODO: Document support for long-lived API keys.
  • Requests and responses will be in unified JSON format.

Model API

  • Model specific changes are part of modules and are exposed by implementation of abstract function definitions.
  • Naming of Models and fields should follow database naming, how-ever during 'transition' from 'APIv1' to 'APIv2' mapping might be required.
  • Permissions are modeled in CRUD (Create, Read, Update, Delete) principle on a per model basis. Their will be an mapping to support 'old' User/API permission schemes.
    • TODO: Implement #872

Helper API

TODO: Implement and document #871

  • Permissions will be an combination of model CRUD permission, depending on models and actions of helper function.

Futher work

  • 'expandables' are implemented in AbstractBaseAPI, how-ever they are specifically linked a DBA model, which could cause conflicts when names are re-used, thus needs to be moved.

References

  • Automated APIv2 documentation (Swagger UI): https:///apidocs