Create custom actions with API

Rest Swagger API ile Custom Action oluşturma ve kullanmayı öğrenin.

You can use Rest Swagger API as a data source while developing applications with Kuika.

This training content consists of the following topics:

  1. Data Source Connection with Rest Swagger API

  2. Listing with Rest Swagger API on List Screen

1. API Data Source Connection with Rest Swagger

To make a data source connection with the Rest Swagger API, go to the Datasources view mode in the project you are working on in Kuika.

Datasources, actions and tables in the application you developed through the left menu in the Datasources view mode, and you can add a new data source, a new action, and a new table.

+ icon opposite the datasources heading to add a new data source to the application you are developing.

Datasources görünüm modu Rest Swagger API Seçimi ekran görüntüsü

To add Rest Swagger API as a data source to the application you are developing, select the Rest Swagger API type as the Datasource type on the screen that opens and name the data source connection. We named it Rest within the scope of this training content. After completing the naming process, click the CREATE button.

Enter the Swagger URL information and Service Base URL on the screen that opens.

The connection will be established with the KuikaSwaggerAPI resource created as an example in this training content.

Enter https://builder3.kuika.com/KuikaSwaggerAPI/swagger/docs/v1 (Swagger URL) URL at https://builder3.kuika.com/Kuikapi/swagger/ui/index as Swagger Url information. Then enter the URL https://builder3.kuika.com/KuikaSwaggerAPI which is on the same site and has Base URL information.

Then, select No Auth, Kuika Auth and API Key authentication types in the drop-down menu titled Authentication Type.

Then click the CREATE button to create the Datasources link.

The connection you created automatically pulls the queries in KuikaSwaggerAPI as an action.

KuikaSwaggerAPI are listed under the relevant data source connection in the left menu on the Custom Actions tab in the DataSources view mode and in the UI Design view mode.

can connect the actions you take to the application screens you develop through the KuikaSwaggerAPI data source.

Let's move on to the scenario where the stocks of the products in the data source are listed for an example list screen.

First create a list screen to connect the relevant action on the list screen to take stock of the products in the KuikaSwaggerAPI data source. For this, drag and drop a Table element from the DataRepeater elements to the screen. Then name the columns of the table. To change the column titles, select any Table Column under the title you want to change and enter the title you want to add to the title property in its properties. Then drag and drop Label elements into the columns of the table. After creating a simple listing screen, you can move on to working with actions.

Every time the Item Stock screen is opened, you must add an Initial Action to retrieve the stock information of the products.

ADD ACTION button in Screen Properties to add Initial Action.

Initial Actions > Custom > Datasource in the menu that opens. When hovering over the Datasource titled Rest, the custom actions created with Rest Swagger will be listed. Click on the special action StokGetProductListFromRest from this list.

You must determine the data source of the table to link the table that will perform the listing function later with the inventory information list of the products. Select the Table element on the screen to determine the data source of the table.

Open datasource menu via Properties opened on the right.

Click on the drop-down menu under the Action heading in the menu that opens. In the menu, select the special action StokGetProductListFromRest, which will allow listing stock information. You now have the table's data source provisioned.

Start the process of dynamically pulling the value of the Label elements in the table to which the ID information will be written from the data source to which the table is connected. To perform this operation, first, click on one of the Label elements in the ID column.

Then open the value player via properties that opens on the right. In the menu that opens, click on the drop-down menu under the Field to Display heading.

Select the ID item in the menu.

Start dynamically pulling the value of the Label elements in the table to which the Stock Kod information will be written from the data source to which the table is connected.

To perform this operation, first, click on one of the Label elements in the Stock Kod column.

Then open the value menu via properties that opens on the right.

Menu under the Field to Display heading in the menu that opens.

Select the StokKod item in the menu.

Label elements in the table, which will be written by the product names, from the data source to which the table is connected. To perform this operation, first, click on one of the Label elements in the Name column.

Then open the value menu via properties that opens on the right.

Menu under the Field to Display heading in the menu that opens.

Select the StokAd item in the menu.

Finally, start the process of dynamically pulling the value of the Label elements in the table to which the barcode information will be written from the data source to which the table is connected. To perform this operation, first, click on one of the Label elements in the Barcode column.

Then open the value menu via properties that opens on the right.

menu under the Field to Display heading in the menu that opens.

Select the StokBarkod item in the menu.

Click the Preview button to test the work you have developed.

Last updated