Database CRUD APIs Auto-Generation

Users can auto-generate CRUD API endpoints for any database using the Data Source Browser. CRUD APIs are meant for Create-Retrieve-Update-Delete operations on the database table records.

1. Click on View in the main menu bar and select Data Source Browser from the drop-down menu.

01-Data-Source-Browser-Menu

This will open the Data Source Browser.

02-Data-Source-Browser-Open

2. Add a new database server by selecting the Add Database Server option.

03-Data-Browser-Add

This will open a configuration window to define a database connection. A database server can be configured from any of the listed providers.

02-01-Data-Source-List

3. Add all the essential details to configure the database server connection and click OK.

04-Data-table-Configure

Now, the Data Source Browser will be populated with all the databases from the connected server.

05-Tables-Browser

4. Right-click on any database and select Generate CRUD flows from the context menu.

Note: It is necessary for a project to be open when CRUD API flows are generated, since they are added under a CRUD folder created in the project.

06-CRUD-Flows-Option

This will open a new window.

Here, you can select the tables and the respective CRUD operations to generate API flows.

07-CRUD-Window

For our use case, we will be selecting the Orders table. The following operations are available for each table:

1. Find all records – A Get method that fetches all the records

2. Get record by ID – A Get method along with a path parameter for a key that fetches the records based on the key.

3. Create a new record – Selecting this creates a new record.

4. Update a record by ID – Selecting this option lets the user update a record by ID

5. Delete a record by ID – Selecting this option lets the user delete a record by ID.

08-CRUD-Table-Selection

The user can even select configurations inside each endpoint, whether they want to enable sort or filter, or whether their execution type is Synchronous or Asynchronous.

5. Once done, click Generate and the CRUD flows will be generated.

12-CRUD-Trace

You can then view the API endpoints in the Project Explorer.

09-CRUD-Tables-Generated

6. Now, you can directly group and deploy with a single click,

11-Group-Deploy

or open any of the API flows to see pre-configured API flows or make any changes.

10-API-Flows

This concludes the working of the Database APIs CRUD auto-generation in Astera Centerprise.