You are here: Designing an Application > Add Actions > Network APIs

Network APIs Actions

From the Network APIs section of the list of actions available along the left column of the Action Editor, you can add the following three actions. Click an action for instructions on how to add it to an action sequence.

Invoke Synchronous Service

Invoke Asynchronous Service

Invoke Object Service

Invoke Identity Service

Invoke Synchronous Service

The Invoke Synchronous Service action in the Action Editor calls a synchronous service in response to the triggering of an event for a widget. When you add a synchronous service to an action sequence, all the services that are part of the service definition file appear in the drop-down list.

When you make a service call, you have the option to make a secure call (https call). You also have the option to block the UI till the service call is complete. Selecting this option blocks the UI and prevents you from performing other actions on the UI.

Block UI

Freezes the UI till the service call is complete.

Secure

Makes the service call through a secure connection, i.e., https protocol.

Note: Block UI and Secure are mutually exclusive options. You can select either of the options, both the options, or none of the options based on your requirement.

Open Mapping Editor

This button is enabled when you select a service. With the Mapping Editor you can map the service parameters to the widgets on the form from which the service was invoked.

Add Custom HTTP Headers

You can add your own custom http headers in this frame. You can define any information you want to pass in the header of the service call, apart from the default header parameters. Each row allows you to add a custom header parameter along with its value. You can define the value in the Mapping Editor or write an expression to derive the value.

The header name must be unique for every custom header. You can give any name to the custom headers you define except for the reserved header names. However, it is recommended to use user-friendly names for the headers.

Note: Authorization is a reserved header name that captures the user authentication details.

To define an action sequence for invoking a synchronous service, do the following:

  1. From the Project tab of the Project Explorer, select the widget you want to apply the action to. Once it’s highlighted on the Visualizer Canvas, right-click it, and then select one of the action sequences, such as onTouchStart. Doing so opens the Action Editor and creates an action sequence for you to configure.
  2. From the list of actions available along the left column of the Action Editor, click Invoke Synchronous Service from the Network APIs section. The action is added to the action sequence and is the current action of focus.
  3. In the bottom pane of the Action Editor, select a service from the drop-down list.
  4. Click Open Mapping Editor. The Mapping Editor opens.
  5. Map the service parameters to variables, data store keys, or widgets on the form from which the service was invoked.
  6. Click Finish on the Mapping Editor. An action sequence is defined for invoking a synchronous service.

Invoke Asynchronous Service

For invoking an asynchronous service when an event is triggered for a widget, use this action sequence in the Action Editor. When you add an asynchronous service to an action sequence, all the services that are part of the service definition file appear in the drop-down list.

When you make a service call, you have the option to make a secure call (https call).

Secure

Makes the service call through a secure connection, i.e., https protocol.

Open Mapping Editor

This button is enabled when you select a service. The Mapping Editor enables you to map the service parameters to the widgets on the form from which the service was invoked.

Add Custom HTTP Headers

You can add your own custom HTTP headers in this frame. You can define any information you want to pass in the header of the service call, apart from the default header parameters. Each row allows you to add a custom header parameter along with its value. You can define the value in the Mapping Editor or write an expression to derive the value.

The header name must be unique for every custom header. You can give any name to the custom headers you define except for the reserved header names. However, it is recommended to use user-friendly names for the headers.

Note: Authorization is a reserved header name that captures the user authentication details.

To define an action sequence for invoking an asynchronous service, do the following:

  1. From the Project tab of the Project Explorer, select the widget you want to apply the action to. Once it’s highlighted on the Visualizer Canvas, right-click it, and then select one of the action sequences, such as onTouchStart. Doing so opens the Action Editor and creates an action sequence for you to configure.
  2. From the list of actions available along the left column of the Action Editor, click Invoke Asynchronous Service from the Network APIs section. The action is added to the action sequence and is the current action of focus.
  3. In the bottom pane of the Action Editor, select a service from the drop-down list.
  4. Click Open Mapping Editor. The Mapping Editor opens.
  5. Map the service parameters to variables, data store keys, or widgets on the form from which the service was invoked.
  6. Expand the Asynchronous Service node on the left frame.
  7. Right-click callback sequence and define an appropriate Action Sequence for the callback sequence.
  8. Click Finish on the Mapping Editor. An action sequence is defined for invoking an asynchronous service.

Invoke Object Service

For invoking an Object service when an event is triggered for a widget, use this action sequence in the Action Editor. When you try to add an Object service to an action sequence, all Object services that are part of the service definition file appear in the drop-down list.

To define an action sequence for invoking an Object service, do the following:

  1. From the Project tab of the Project Explorer, select the widget to which you want to apply the action.
  2. Once it is highlighted on the Visualizer Canvas, right-click it and then select one of the action sequences, such as onTouchStart. Doing so opens the Action Editor and creates an action sequence for you to configure.
  3. From the list of actions available on the left column of the Action Editor, click Invoke Object Service in the Network APIs section. The action is added to the action sequence and is the current action of focus.
  4. In the bottom pane of the Action Editor, choose an Object service from the Select Service drop-down list.
  5. Then, choose an accompanying method from the Select Method drop-down list.

    Note: From V8 SP3 onwards, Kony Visualizer supports GET, CREATE, UPDATE, PARTIAL-UPDATE, and DELETEoperations. To provide request/input mapping, click on Open Mapping Editor. You can map the service request parameters to the variables, data store keys or widgets on the form .
  6. Click Add Mapping. The Mapping Editor opens.
  7. Map the Object service parameters to variables, data store keys, or widgets on the form from which you have invoked the Object service.
  8. Expand the Object Service node on the left frame.
  9. Right-click callback sequence, and define an appropriate Action Sequence for the callback sequence.
  10. Save your changes. An action sequence is defined for invoking an Object service.

Invoke Identity Service

Under the Network APIs available in Visualizer, a new API is added. The new API is called Invoke Identity Service. When you use this API, the list of all identity services created and linked to the associated Kony Fabric application is displayed. You can view the type of the identity service and if there are any request parameters or response structure in the mapping editor, you can view them too. If the identity service is of type OAuth or SAML, a default browser widget is created on the form. You can choose whether the operation is login or logout on the identity service.

To define an action sequence for invoking an Object service, do the following:

  1. From the Project tab of the Project Explorer, select the widget to which you want to apply the action.
  2. Once it is highlighted on the Visualizer Canvas, right-click it and then select one of the action sequences, such as onTouchStart. Doing so opens the Action Editor and creates an action sequence for you to configure.
  3. From the list of actions available on the left column of the Action Editor, click Invoke Identity Service in the Network APIs section. The action is added to the action sequence and is the current action of focus.
  4. In the bottom pane of the Action Editor, choose an identity service from the Select Service drop-down list.
  5. Then, choose an accompanying method from the Select Method drop-down list.
  6. Click Add Mapping. The Mapping Editor opens.
  7. Map the Identity service parameters to variables.
  8. Click Finish on the Mapping Editor. An action sequence is defined for invoking an Object service.
Copyright © 2013 Kony, Inc. All rights reserved.