Liberty API
Description: Liberty API provides a powerful and scalable backend for managing authentication, database operations, and framework functionalities in the Liberty Framework.
🔹 Key Features:
- Authentication & Authorization: Secure endpoints with JWT tokens and OAuth2.
- Database Management: Query, insert, update, and delete records across multiple pools.
- Framework Controls: Manage modules, applications, themes, and logs.
- Security & Encryption: Encrypt data and ensure safe database access.
- Logging & Auditing: Retrieve and analyze logs for security and debugging.
🔹 Authentication
/api/auth/token
- Generate a JWT token for authentication./api/auth/user
- Retrieve authenticated user details.
🔹 Database Operations
/api/db/check
- Validate database connection./api/db/query
- Retrieve, insert, update, or delete records./api/db/audit/{table}/{user}
- Audit changes on a specific table.
🔹 Framework Features
/api/fmw/modules
- Retrieve framework modules./api/fmw/applications
- Retrieve available applications./api/fmw/themes
- Manage application themes.
🔗 Explore the API using Swagger UI (/api/test
) or Redoc (/api
).
Version: 1.0.0
Authentication
AUTH - User
Retrieve user information.
GET /api/auth/user
Query Parameters
user
(in query): User ID.pool
(in query): The database pool alias to retrieve the user. (e.g.,default
,libnsx1
)mode
(in query): The session mode, retrieve data from framework table or pool. Valid values:framework
,session
📥 Responses:
Response 200
: Get user information
- Content-Type:
application/json
-
Example:
Response 422
: Unprocessable Entity
- Content-Type:
application/json
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
AUTH - Token
Generate a JWT token for the user.
POST /api/auth/token
Query Parameters
pool
(in query): The database pool alias to retrieve the user. (e.g.,default
,libnsx1
)mode
(in query): The session mode, retrieve data from framework table or pool. Valid values:framework
,session
type
(in query): Authentication type, from database or using OIDC. Valid values:database
,oidc
Request Body
- Content-Type:
application/json
-
Example:
📥 Responses:
Response 200
: Authentication successful, JWT token generated
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
Framework
FMW - Applications
Retrieve Applications.
GET /api/fmw/applications
Query Parameters
- None
📥 Responses:
Response 200
: Get Applications Available
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
FMW - Modules
Retrieve Modules.
GET /api/fmw/modules
Query Parameters
- None
📥 Responses:
Response 200
: Get Modules Details
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
FMW - Themes
Retrieve Themes Definition.
GET /api/fmw/themes
Query Parameters
- None
📥 Responses:
Response 200
: Get Themes Details
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
FMW - Get logs
Get all current logs and upload to cache
GET /api/logs
Query Parameters
- None
📥 Responses:
Response 200
: Successful Response
- Content-Type:
application/json
FMW - Get log details
Get details for a log id from the cache
GET /api/logs/details
Query Parameters
- None
📥 Responses:
Response 200
: Successful Response
- Content-Type:
application/json
FMW - Encrypt
Encrypt the input received
POST /api/fmw/encrypt
Query Parameters
plain_text
(in query): Text to be encrypted
📥 Responses:
Response 200
: Encryption successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
FMW - Push logs
Push logs to files in json and plain text format
POST /api/logs
Query Parameters
- None
📥 Responses:
Response 200
: Successful Response
- Content-Type:
application/json
Database
DATABASE - Check
Performs a basic check to ensure the database connection is functional. Returns the current date if the connection is successful.
GET /api/db/check
Query Parameters
framework_pool
(in query): Pool alias to retrieve the database definition. (e.g.,default
,libnsx1
). (Default:default
)target_pool
(in query): Pool alias of the database to check. (e.g.,nomasx1
,nomajde
). (Default:default
)
📥 Responses:
Response 200
: Database connection is successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
DATABASE - Close
Close all database connections for the specified pool alias.
GET /api/db/close
Query Parameters
pool
(in query): Pool alias for the database to close. (e.g.,default
,libnsx1
). (Default:default
)
📥 Responses:
Response 200
: Pool closed successfully
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
DATABASE - Open
Open a connection to the database using the specified pool alias.
GET /api/db/open
Query Parameters
framework_pool
(in query): Pool alias to retrieve the database definition. (e.g.,default
,libnsx1
). (Default:default
)target_pool
(in query): Pool alias of the database to open. (e.g.,libnsx1
,nomasx1
,nomajde
). (Default:default
)
📥 Responses:
Response 200
: Pool opened successfully
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
Query
QUERY - Select
Retrieve data or metadata from the database based on query parameters. Supports filtering, language and pagination.
GET /api/db/query
Query Parameters
source
(in query): The source to retrieve the query definition. Valid values:framework
,query
type
(in query): The type of query, get data or metadata. Valid values:table
,columns
.pool
(in query): The database pool alias to retrieve the query definition. (e.g.,default
,libnsx1
)mode
(in query): The session mode, retrieve data from framework table or pool. Valid values:framework
,session
query
(in query): The query ID to execute. (e.g.,1
,2
)override_pool
(in query): Override the default pool set in the query definition. (e.g.,default
,libnsx1
)q
(in query): Filters to apply to the query in JSON format (e.g.,[{'APPS_ID':{'=':10}, 'APPS_NAME':{'like':'LIBERTY%'} }]
).language
(in query): The language for query execution. (e.g.,en
,fr
). (Default:en
)offset
(in query): The number of rows to skip before starting to fetch. (Default:0
)limit
(in query): The maximum number of rows to return. (Default:1000
)params
(in query): Additional parameters in JSON format to replace variable in a query (e.g.,[{'APPS_ID': 10}]
).
📥 Responses:
Response 200
: Data retrieved successfully
- Content-Type:
application/json
-
Example:
Response 400
: Bad Request
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
QUERY - Audit
Audit user actions on a table.
POST /api/db/audit/{table}/{user}
Query Parameters
table
(in path): No description (Required)user
(in path): No description (Required)
📥 Responses:
Response 200
: Data inserted/updated successfully
- Content-Type:
application/json
-
Example:
Response 400
: Bad Request
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
QUERY - Insert
Insert data into a table.
POST /api/db/query
Query Parameters
source
(in query): The source to retrieve the query definition. Valid values:framework
,query
type
(in query): The type of query, get data or metadata. Valid values:table
,columns
.pool
(in query): The database pool alias to retrieve the query definition. (e.g.,default
,libnsx1
)mode
(in query): The session mode, retrieve data from framework table or pool. Valid values:framework
,session
query
(in query): The query ID to execute. (e.g.,1
,2
)override_pool
(in query): Override the default pool set in the query definition. (e.g.,default
,libnsx1
)
Request Body
- Content-Type:
application/json
-
Example:
📥 Responses:
Response 200
: Data inserted/updated successfully
- Content-Type:
application/json
-
Example:
Response 400
: Bad Request
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
QUERY - Update
Update data into a table.
PUT /api/db/query
Query Parameters
source
(in query): The source to retrieve the query definition. Valid values:framework
,query
type
(in query): The type of query, get data or metadata. Valid values:table
,columns
.pool
(in query): The database pool alias to retrieve the query definition. (e.g.,default
,libnsx1
)mode
(in query): The session mode, retrieve data from framework table or pool. Valid values:framework
,session
query
(in query): The query ID to execute. (e.g.,1
,2
)override_pool
(in query): Override the default pool set in the query definition. (e.g.,default
,libnsx1
)
Request Body
- Content-Type:
application/json
-
Example:
📥 Responses:
Response 200
: Data inserted/updated successfully
- Content-Type:
application/json
-
Example:
Response 400
: Bad Request
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
QUERY - Delete
Delete data into a table.
DELETE /api/db/query
Query Parameters
source
(in query): The source to retrieve the query definition. Valid values:framework
,query
type
(in query): The type of query, get data or metadata. Valid values:table
,columns
.pool
(in query): The database pool alias to retrieve the query definition. (e.g.,default
,libnsx1
)mode
(in query): The session mode, retrieve data from framework table or pool. Valid values:framework
,session
query
(in query): The query ID to execute. (e.g.,1
,2
)override_pool
(in query): Override the default pool set in the query definition. (e.g.,default
,libnsx1
)
Request Body
- Content-Type:
application/json
-
Example:
📥 Responses:
Response 200
: Data inserted/updated successfully
- Content-Type:
application/json
-
Example:
Response 400
: Bad Request
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
Setup
SETUP - Current
Get the current version deployed
GET /api/setup/current
Query Parameters
- None
📥 Responses:
Response 200
: Installation successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
SETUP - Downgrade
Downgrade databases to a specific version
POST /api/setup/downgrade/{version}
Query Parameters
- None
📥 Responses:
Response 200
: Installation successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
SETUP - Installation
Configure the postgres database.
POST /api/setup/install
Query Parameters
- None
Request Body
- Content-Type:
application/json
-
Example:
📥 Responses:
Response 200
: Installation successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
SETUP - Revision
Create a new revision for the database
POST /api/setup/revision
Query Parameters
- None
📥 Responses:
Response 200
: Installation successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
SETUP - Upgrade
Upgrade databases to latest version
POST /api/setup/upgrade
Query Parameters
- None
📥 Responses:
Response 200
: Installation successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example:
Export
EXPORT - Repository for Deployment
Export all tables models and data.
GET /api/export/repository
Query Parameters
- None
📥 Responses:
Response 200
: Installation successful
- Content-Type:
application/json
-
Example:
Response 422
: Validation Error
- Content-Type:
application/json
-
Example:
Response 500
: Internal server error
- Content-Type:
application/json
-
Example: