OpenFlower comes with a feature-rich REST API, so you can use it in OpenFlower Apps or extend OpenFlower with new functionality.
Authentication
Session Cookie
In application properties of the API-Service - or as ENV Variable in Docker setups, you can set a name for the Cookie. In our ExamplesLOWCODER_CE_SELFHOST_TOKEN
With this value, you can then authenticate API Calls.
If no user is logged In, API Calls will get executed in the name of "Anonymous User" and for most of the API Calls, this user has no desired rights.
If you are logged in, the Cookie of the currently logged-in user will be used to make API Calls in the name of the current user. This means, that Access Rights to different Functions are automatically applied by the Role of the User. (Admin, Member, Visitor)
If you want to use the API from outside of OpenFlower, you need to authenticate first and use the Cookie as the LOWCODER_CE_SELFHOST_TOKEN API key in every API Call.
The Base URL of the OpenFlower API depends on your installation.
Single Docker Deployment
The Base URL of the API is the same as for the Frontend. In local installations for example:
Multi-Docker Deployment
In a Multi-Docker Deployment, you will have an individual IP address or Domain for the API-Service Container. This is then the Base URL for the OpenFlower API.
When you run Multi-Docker Deployment on Localhost, you will need to look for the Bridge-Network Settings that apply to your setup.
Since OpenFlower v2.1.6 we publish the OpenAPI Specification and the Swagger Documentation automatically.
You can find the current API Documentation for example here: coming soon.
Using OpenFlower API - inside OpenFlower Apps
Since OpenFlower v2.0.0, it is possible to use the OpenFlower REST API inside of Apps in OpenFlower itself. To do so, create an OpenAPI specification-based Data Source.
Connect the OpenFlower API as OpenAPI Datasource
Use your defined LOWCODER_CE_SELFHOST_TOKEN as API Key Auth. It will be automatically replaced by the adapted Cookie if a User is logged in.
Also, you can use the API Key to interact with the OpenFlower API as an impersonated user.
The OpenAPI specification Document is automatically generated. The Server URL is your API-Service URL. Please read more about it here
As soon as connected and the OpenAPI specification is found and processed, the API Controllers are accessible in the Datasource.
Select a Controller to see it's Operations
For each Controller, you can see then the possible Operations.
Find the list of possible Operations for the selected Controller
Now you can execute the API Call based on its settings.
// use the OpenFlower API to generate the JWT based API Key
curl --location '<your lowcoder location>/api/auth/api-key' \
--header 'cookie: LOWCODER_CE_SELFHOST_TOKEN=<generatedCookieValue>;' \
--header 'Content-Type: application/json' \
--data '{
"name":"<your api key name>",
"description": "A wonderful API Key"
}'