Business Console 10.7 | webMethods Business Console Documentation | Developing Gadgets for Business Console | Programming Gadgets | Generating REST Connector Code for REST Services | Drag and Drop Existing REST Resources to Generate the Gadget UI
 
Drag and Drop Existing REST Resources to Generate the Gadget UI
The UI elements are generated by reading Integration Server REST API Descriptors. After the REST API Descriptor code is generated in the gadget, you need to deploy it on My webMethods Server to make it available on Business Console.
*To drag and drop existing REST resources to generate the gadget UI
1. Launch Software AG Designer in the UI perspective.
2. In the Solutions tab, create a new gadget, portlet, or web application.
3. Under the newly created portlet project, create a new Business Console Gadget.
4. In the Package Navigator tab, create or identify the REST resource services in the project.
5. Create a REST API Descriptor and associate the identified REST resource services with the REST API Descriptor.
6. Specify the REST API details.
7. Drag and drop the REST API Descriptor you created, into the view.xhtml page of the newly created portlet project.
The New REST Connector wizard opens.
8. In the New REST Connector wizard, verify the gadget project details, and click Next.
9. Select the REST resource service and a method such as GET, POST, PUT, or DELETE and click Finish.
10. Type a name in the Page Name field.
This name appears as form name on the web UI.
11. Select the services and fields for which you want to create the REST UI connector code. Subsequently, configure the fields and click Next.
REST resource type
Actions you can perform
GET
Specify the following information:
*Input Parameters. You can modify the Display Label, Mandatory, Validation, and UI Control fields. The Input Type field cannot be modified. Only flat fields are accepted for GET; complex types are not supported.
*Output Parameters. You can modify the Display Label, Type, and UI Control fields. The Input Type field can be modified only for String Array type. It can be set either as StringArray or StringTable.
If the type is a StringTable type on the Integration Server, this has to be selected as StringTable if it has to work properly. Else it is treated as StringArray by default.
*Select the column count for IN and OUT parameters.
*Set pagination details by selecting Page Number, Page Size, Start Index, End Index, and Total Records. Pagination is applicable only for array types. The parameters shown in the list includes only path and query parameters.
The parameter list for Total Records column includes all the output parameters of type text and numeric values.
POST
Specify the following information:
*Input Parameters. You can modify the Display Label, Mandatory, Validation, and UI Control fields. The Input Type field cannot be modified.
*Output Parameters. You can modify the Display Label, Type, and UI Control fields. Type can be modified only for String Array type. It can be set either as StringArray or StringTable.
*Select the column count for IN and OUT parameters.
*Set pagination details by selecting Parameter Details, Page Size, and Total Records.
PUT
Specify the following information:
*Input Parameters. You can modify the Display Label, Mandatory, Validation and UI Control fields. The Input Type field cannot be modified.
*Output Parameters. You can modify the Display Label, Type, and UI Control fields. Type can be modified only for String Array type. It can be set either as StringArray or StringTable.
*Select the column count for IN and OUT parameters.
*Set pagination details by selecting Parameter Details, Page Size, and Total Records.
DELETE
Specify the following information:
*Input Parameters. You can modify the Display Label, Mandatory, Validation, and UI Control fields.
*Select the column count for IN and OUT parameters.
*Set pagination details by selecting Parameter Details, Type, Page Number, Page Size, and Total Records.
12. Select the number of input and output parameters for the selected REST service and click Finish.
The files view.xhtml, config.js, and controller.js are updated after the drag and drop operation.
The following files are created: partial.xhtml, directive.js, and style.scss. The file naming format is as follows:
*<operation>-<servicename>-<shortID>.xhtml for partial.xhtml
*<operation>_<servicename>_<shortID>.js for directive.js
*<operation>_<servicename>_<shortID>.scss for style.scss
where, operation is the REST operation type such as GET, POST, PUT, or DELETE, servicename is the complete namespace of the REST service, and shortID is an alpha-numeric ID.
The style.scss file allows you to customise the style of gadgets. For more information about styling gadgets, see Adding Styles in CSS.
13. Make the desired changes to the gadget using Software AG Designer and deploy it to My webMethods Server.
See Deploy gadgets to My webMethods Server for instructions on deploying the modified gadget in the My webMethods Server.
14. Alternatively to deploy the modified project in My webMethods Server, in the Server tab of Designer, right-click on the My webMethods Server instance and select Add and Remove. The Add and Remove dialog box appears.
15. Move the project from the available list to the configured list and click Finish.
This ensures that the gadget is deployed on My webMethods Server. See Add/View Gadgets for more information on adding the modified AgileApps Cloud form as a gadget in Business Console.
16. Ensure that the same version of the modified gadget is deployed on the My webMethods Server and imported as a gadget in an AppSpace on Business Console.