Database CRUD APIs Auto-Generation

Video

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.

This will open the Data Source Browser.

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

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

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

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

  1. 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.

This will open a new window.

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

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.

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.

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

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

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

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

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

Last updated

© Copyright 2023, Astera Software