Designer 10.7 | Working with Business Console Gadgets | Working with Business Console Gadgets | Creating Gadget User Interfaces for a REST Resource
 
Creating Gadget User Interfaces for a REST Resource
You can use both REST and REST V2 resource descriptors to generate custom webMethods Business Console user interfaces, and add those user interfaces to new or existing gadgets.
The high-level steps for creating user interfaces based on REST API Descriptors are as follows:
1. Create a REST or REST V2 resource and generate a REST API descriptor for that resource, using the Package Navigation section on the UI Development perspective in Designer. For more information about REST resource, REST V2 resource, and REST API descriptors, see webMethods Service Development Help.
2. Create a CAF web application project, and add a Business Console gadget to that project.
3. Configure the input and output mapping of REST resources to the Business Console user interface elements, using the REST UI Creation Wizard in the UI Development perspective.
4. Configure the gadget. For more information, see Developing Gadgets for webMethods Business Console.
5. Deploy your project to My webMethods Server and display the gadget in an AppSpace in Business Console.
*To create a user interface for a REST resource
1. Create a web application project.
For more information about creating a web application project, see webMethods CAF and OpenUI Development Help.
2. In the Solutions view, right-click the web application project and select Business Console Gadgets > New Business Console Gadget.
3. Configure your gadget as described in New Business Console Gadget Wizard.
4. In the Solutions view, double-click to open the view.xhtml file for your gadget in the view editor.
5. Double-click the REST API descriptor and select the REST Resources tab, and ensure that the parameters for REST operations such as PUT, GET, and others are correctly configured.
All parameters must be set as QUERY for the GET operation because it can send parameters only through a query string. Similarly, POST and PUT operation parameters must be either QUERY or FORMDATA.
Note:
If you select the Get Operation on Load option in the Pagination and Loading Inputs Configuration page of the REST UI Creation Wizard, a GET operation with same parameters precedes each PUT operation. In this case, ensure that PUT parameters are set to QUERY because the corresponding GET operation can use only QUERY parameters.
6. Drag and drop the required REST API Descriptor to the Design Page of the view editor.
The REST UI Creation Wizard appears.
7. On the Project Selection page, click Next.
Note:
You can edit the Swagger URL field when you start the wizard using the New > Other > Software AG > UI Development > New REST UI menu. Specify a publicly available HTTP URL, or a local file path in the Swagger URL field.
8. On the REST Resources Selection page, specify the following and click Next:
*The REST resources and operations for which you want to create user interface controls. You can select only one operation at a time on the REST Resources Selection page.
*Whether to use Cross-origin resource sharing (CORS) support on host servers, or the Business Console proxy REST service as the REST invocation method.
*Whether to use a global or local URL. To use a global URL, you must specify an alias, and configure the global server settings for gadgets in My webMethods Server. In case of a local URL, the URL in the Swagger metadata is used for accessing the REST resources.
*Whether to use Integration Server or other external servers. If you use other external servers, select Basic in the Select AuthType box, and enter the authentication password and user name. Additionally, you can select None for no authentication.
9. On the Field Configuration page, configure the form in which the Composite Application Framework can generate user interface controls for the selected REST resources as follows:
Field/Table
Description
Form Name
The name of the form to display in Business Console.
Input and Output Parameters
For each user interface control in the table, configure the following fields:
*Name. Select to specify whether to display the control in Business Console.
*Display Label. Click to modify the text displayed on the field label in Business Console.
*Type. You can set the type for String Arrays as either String Array or String Table.
*Mandatory (only for input parameters). Select to specify whether a form control is required. The field appears as a mandatory field on the user interface.
*Validation (only for output parameters). The validation type to apply to the control. This value is populated automatically. The options are Text, E-mail, Alphanumeric, and Numeric.
*UI Control. By default, the framework generates an appropriate user interface control type for each REST parameter. For Ref type parameters, you can select the Tab-Selected option to display the parameter as a selected tab on the form.
If you select the Tab-Selected option for a Ref type parameter, other Ref type parameters at the same level on the Field Configuration page are grouped and displayed as tabs on the form, but they are not selected by default.
*Default Value. Initial value of Text and Numeric fields, String Array, and Numeric Array when the page is loaded.
These fields are only for Table and Array type values:
*SortBy. Parameter name to use for sorting (if REST service supports sorting).
*SortOrder. Parameter name to use for sorting order (if REST service supports sorting order).
*DefaultSortColumn. Select the default column to use for sorting.
*DeafultSortOrder. Select either Ascending or Descending in the list.
Select Column Count for Input and Output Parameters
Select the number of columns in which Business Console displays the generated form. The options are: One, Two, Three, Four, and Six.
10. On the Pagination and Loading Inputs Configuration page, configure the pagination options.
Select the parameter you want to use for each of the available pagination options.
Field
Description
Name
Select the parameter for which to apply pagination.
Type
You cannot modify the data type of the control.
Page Number
Select the parameter for number of pages to display in the Business Console gadget.
Page Size
Select the parameter for number of entries per page.
Start Index
Select the parameter for start index.
End Index
Select the parameter for end index.
Total Records
Total number of records to display.
11. If you have selected the PUT operation in the REST Resources Selection page, select how to load the input parameters. You can select one of the following:
Field
Description
None
No action is performed prior to the PUT operation.
Gadget Configuration Parameter
Specify one or more gadget configuration parameters and map them to input parameters.
Gadget Event
Specify one or more gadget events and map their response to input parameters.
Get Operation on Load
A GET operation with same parameters as the PUT operation precedes the PUT operation.
12. (Optional) Click Browse and save all settings in the REST UI Creation Wizard as a JSON file. This action enables you to load the wizard with the same settings later. To load the wizard using a JSON file, do the following:
a. Go to New > Other > Software AG > UI Development > New REST UI, and click Next.
b. Select Import metadata, and then click Browse to select the JSON file.
c. Click Next.
13. Click Finish.
After Designer generates the user interface, you can configure it further, deploy it to My webMethods Server, and use it in Business Console. For more information about gadget development, see Developing Gadgets for webMethods Business Console. For more information about working with gadgets at runtime, see Working with webMethods Business Console.