Managing Entities through API
The generation of entities in Applipress accomplishes several tasks that pave the way for a robust application architecture. This includes creating:
-
Liquibase scripts for database table creation
-
Test data for the table generated through Faker
-
Corresponding entity classes and endpoints for entity operations
-
OpenAPI definition of entity endpoints
-
Automatically generated test classes for the entity
-
Automatically generated documentation pages for the entity
-
Angular service for managing the entity through the API
-
Automatically generated test classes for the Angular service
These components enable efficient and streamlined management of entities within your application. To illustrate, let's explore how to access and manage the 'Customer' entity through the API:
-
Open the Generated Application: Launch your browser and navigate to the generated application. From the menu, select >Administration >API.
-
Access the GET /api/customers Endpoint: This endpoint is designed to fetch a list of 'Customer' entities from the database.
-
Define a pageable Object: To retrieve a specific page of customer records, define the following pageable object in the request parameters:
{ "page": 0, "size": 10, "sort": [ "id" ] }This object specifies that you wish to retrieve the first page (
page
: 0) of customer records, with up to 10 records per page (size
: 10), sorted by theirid
.
-
Execute the Request: Click on 'Execute' to perform the request. You will receive a list of all 'Customer' entities stored in the database, displayed according to the pagination and sorting parameters you defined.
This process demonstrates the power and flexibility of managing entities via the API in an Applipress-generated application. By leveraging the automatically generated backend infrastructure and frontend services, developers can quickly implement sophisticated data management and retrieval functionalities in their applications.