ApiOpenStudio for developers
This page gives a high level overview of some of the technical aspects of Api Open Studio for developers.
ApiOpenStudio allows you to create and maintain API’s quickly and efficiently in a low-code environment. It gives you all the benefits of working in a coding environment, without the hassle of learning the language, syntax errors and all the usual issues that multiply your development time.
Overview
ApiOpenStudio enables a new tier to the traditional
n-tier architecture, allowing business and programmatic logic to be applied to data before it arrives at your application
Organisation & structure
ApiOpenStudio is designed so that you can define Accounts, Applications & resources. This allows you to split and control your resources and users in a very granular fashion.
For instance, we have a large company with multiple, distinct departments that have their own applications & projects. Each application would have its own resources. Here is a simple example of how you could set up account and applications for one of the departments.
In another example, you could have multiple external clients, you would would create an account for each client, and an application for each project for that client.
Roles & access rights
The default roles allow granular access to properties in the ApiOpenStudio system.
You can also create custom roles to enable access to specific resources in applications or access to resources in multiple applications
The architecture of ApiOpenStudio
ApiOpenStudio is a headless application. So the base application contains only the API, and all core administration resources for ApiOpenStudio to operate: GitHub or GitLab
The administration interface has purposefully been kept separate, to allow for multiple interface flavours to be created and to decouple the admin logic from the API logic. All traffic from the GUI to the API uses core API resources, so you can easily update or extend the core resources (if you really want to), or even write your own or extend and existing GUI: GitHub or GitLab
We have very thoughtfully create a docker repository for local development and testing. It is very easy to create a base install with API, GUI, email capability, wiki (optional), PHPDoc (optional): GitHub or GitLab
Resources & processors
At the heart of ApiOpenStudio, and processors and resources.
Processors
Programs can be reduced down to simple semantic blocks, e.g. foreach, do, while, fetch data, etc.
That is exactly what processors represent, the semantic blocks in programming (essentially functions, if you take the purist view of Functional Programming) – data (or multiple data points come in), is processed and then output. this output is either the final output of the resource, or the input into another processor.
Processors are essentially modules. A lot are shipped with ApiOpenStudio base install, but can create your own, or install community contributed Processors.
Resources
Resources are what loom the processors together into the logic of your resource, and where you will do all your work.. You define the logic of how the data flows from one processor into another, through to the final result which can be in the resource response, stored on a remote server or sent in an email.
Resources can be imported and exported in OpenApi format, or created/edited/deleted in the administrative interface.
Resource files
All API resources are stored in the database. You can import and export all resources (if your user has sufficient privileges) in JSON or YAML format to work on in your favourite IDE, or work directly in the Admin GUI. The files can be split into 3 main sections.
Security
Security is defined at the resource level, in a granular fashion. This is defined the security section in the JSON/YAML for each resource, enabling fine-grained control for each resource or by groups of resources.
Security features include:
* JWT tokens
* Bearer tokens
* Authenticated role based access
* X-CSRF tokens
Or you can omit security entirely and open your resources to public access.
Process
Programming and processing of data can be reduced to basic semantic blocks, like:
* Do this
* While condition
* Foreach
* Do something else
* Fetch the result from a remote endpoint
* Do something to the data
* Foreach item in the data
* Get something from this
* Return the result
This is where ApiOpenStudio operates. ApiOpenStudio defines each of these semantic blocks as entities, called ‘PROCESSORS’. Data flows through multiple inputs and outputs in the processors, through to the final result.
As the developer, you define the processors that you want to use and how they link together – what output from a processor flows into another processor. In this way, you can very quickly build up a very complex program.
Output
You can either return the result of the Process step in the result or in multiple outputs.
The result format is dynamically defined by the Accept header. This means that the same result can be returned as JSON, XML, text, HTML, or even an image, without any extra coding from you, just defined by the consumer’s call.
You can also send the results via other channels:
* Email (in the body or as an attached file).
* File.
* Store on a remote server.
Sample resource file
The file below is one that ships with core, and returns all metadata of a specific processor or all processors.
Looking in detail into the process section, it implements only one processor (processors).
processors has a single input that it requires (machine name). The value for this is fetched from the first URI index, using the var_uri processor.
# Processors resource.
#
# @package Apiopenstudio
# @license This Source Code Form is subject to the terms of the ApiOpenStudio Public License.
# If a copy of the license was not distributed with this file,
# You can obtain one at https://www.apiopenstudio.com/license/.
# @author john89 (https://gitlab.com/john89)
# @copyright 2020-2030 Naala Pty Ltd
# @link https://www.apiopenstudio.com
name: Processors
description: Fetch details of processors.
uri: processors
method: get
appid: 1
ttl: 3600
security:
processor: token_roles
id: processors_security
token:
processor: bearer_token
id: processors_token
roles:
– Account manager
– Application manager
– Developer
validate_account: false
validate_application: false
process:
processor: processors
id: processors_process
machine_name:
processor: var_uri
id: processors_machine_name
index: 0
Documentation Api Open Studio for developers
For more details on Api Open Studio for developers, checkout the links on:
* /documentation
* /install-apiopenstudio
* https://phpdoc.apiopenstudio.com/
* https://wiki.apiopenstudio.com/
* https://hub.docker.com/repository/docker/naala89/apiopenstudio
* https://hub.docker.com/repository/docker/naala89/apiopenstudio_admin
* /questions-answers
Contributing
ApiOpenStudio is an open source project. This means that you can raise issues at the GitLab repositories for the community to fix:
You can find answers to, or ask your own questions at /questions-answers.
Or even contribute yourself! Contributing guidelines are available at the above repositories, and also at Wiki – Contributing