Develop APIs

Configuration workflow

 

Procedure

  1. From the left navigation pane, select Application Integration > Develop APIs.

  1. Select a service gateway from the service gateway filter list.

  1. Click Create.

You are placed on the API Orchestration Designer page. On the left of the page, you can orchestrate the APIs. On the right of the page, you can configure API attributes.

  1. Perform the following tasks to develop APIs through drag-and-dropping:

  1. Click Save.

  1. To debug the application, click Debug. To verify the orchestration, click Verify.

  1. To import an orchestration file, click Import. Importing a file will overwrite the current data preview. Only JSON files are supported.

  1. Click Save to save the application.

  1. To close the orchestration designer, click Close.

  1. On the API development page, click Deploy in the Gateway to deploy the API in the service gateway.

API orchestration designer

Figure-1 API orchestration designer

 

Table-1 API orchestration designer

Section

Description

Toolbar

Allows you to zoom in or zoom out the orchestration section, debug and save the application, download images, verify the orchestration, import an orchestration file, and close the orchestration designer.

Icons

Provides component icons for you to drag-and-drop to the orchestration area and define attributes for them. The following types of component icons are available:

  • API—Specifies an API.

  • Logical—Describe template execution flow, including assignment, decision, pending, loop, break, and scripts.

Orchestration

Allows you to orchestrate the API.

Configuration

Allows you to configure the API or component icons as needed.

  • Interface Attributes—To configure interface attributes, click the canvas. You can configure basic settings and global contexts for an API and preview the data.

  • Component icon attributes—To configure attributes for a component icon, drag-and-drop that icon to the canvas, and then click that icon. The attributes vary depending on the component icon type.

 

Configure component icons

Configure the API component icon

Drag-and-drop the API component icon to the canvas, click the icon, and then edit the attributes for it in the configuration pane to the right of the page.

Attribute

Description

Basic Info

Name

Specify an API name, a string of 1 to 64 characters. The value can contain Chinese characters, letters, digits, dots (.), hyphens (-), and underlines (_). It can start with a letter or Chinese character.

When you bind a policy to an API or subscribe to an API, you can select an API by its name.

Description

Specify an API description, a string of 0 to 128 characters.

Configuration Information

Backend Service

Select a backend service.

API Data

Select API data.

Path

Path for the API.

Request Method

Request method for the API. This field is automatically populated based on the model of the device you selected.

Input Parameters/Output Parameters

Configure input and output parameters as needed.

Attempts

Set the maximum number of attempts to access the API. If the limit is reached, the API is unavailable.

Timeout

Set the timeout for access to the API.

Timeout Unit

Specify the timeout unit.

 

Configure the assignment component icon

Drag-and-drop the assignment component icon to the canvas, click the icon, and then edit the attributes for it in the configuration pane to the right of the page. You can assign values to variables used in the workflow. You can select global contexts as variables and values or manually specify variables and values.

Attribute

Description

Basic Info

Name

Specify a name for the assignment component icon, a string of 1 to 64 characters. The value can contain Chinese characters, letters, digits, dots (.), hyphens (-), and underlines (_). It can start with a letter or Chinese character.

Description

Specify a description for the assignment component icon, a string of 0 to 128 characters.

Configuration Information

Configure the assignment component icon by selecting a context or defining a custom context.

For the configuration to take effect, click Add.

 

Configure the decision component icon

Drag-and-drop the decision component icon to the canvas, click the icon, and then edit the attributes for it in the configuration pane to the right of the page. With a decision icon, you can define multiple branches based on constants or variables to support different services.

Attribute

Description

Name

Specify a name for the decision component icon, a string of 1 to 64 characters. The value can contain Chinese characters, letters, digits, dots (.), hyphens (-), and underlines (_). It can start with a letter or Chinese character.

Description

Specify a description for the decision component icon, a string of 0 to 128 characters.

Configuration Information

  • Add a branch

1.     Click Add Branch. In the dialog box that opens, click Add Criterion.

2.     Enter the branch name, click Add Criterion, select Global Constants or Variables, and specify the criterion.

3.     To add more criteria, click Add Criterion.

4.     To clear all criteria, click Clear All.

5.     Click OK.

  • To delete a branch, click Delete.

You can add a maximum of 11 branches, and you can select the default and true branches

 

Configure the loop component icon

Drag-and-drop the loop component icon to the canvas, click the icon, and then edit the attributes for it in the configuration pane to the right of the page. A loop icon is used to iterate over a set of objects. You can connect a loop to other icons such as assignment and decision.

Attribute

Description

Name

Specify a name for the loop component icon, a string of 1 to 64 characters. The value can contain Chinese characters, letters, digits, dots (.), hyphens (-), and underlines (_). It can start with a letter or Chinese character.

Description

Specify a description for the loop component icon, a string of 0 to 128 characters.

Configuration Information

  • Object—Select an array from global variables.

  • Iteration Variable—Select a global variable.

  • Transversal Order—Select Ascending or Descending.

 

Configure the break component icon

Drag-and-drop the break component icon to the canvas, click the icon, and then edit the attributes for it in the configuration pane to the right of the page. Use break icons to break out of loops. This type of icons must be used together with loop icons.

Attribute

Description

Name

Specify a name for the break component icon, a string of 1 to 64 characters. The value can contain Chinese characters, letters, digits, dots (.), hyphens (-), and underlines (_). It can start with a letter or Chinese character.

Description

Specify a description for the break component icon, a string of 0 to 128 characters.

Break

Select the loop to exit.

 

Configure the pending component icon

Drag-and-drop the pending component icon to the canvas, click the icon, and then edit the attributes for it in the configuration pane to the right of the page. With a pending component icon, you can define a wait timer.

Attribute

Description

Name

Specify a name for the pending component icon, a string of 1 to 64 characters. The value can contain Chinese characters, letters, digits, dots (.), hyphens (-), and underlines (_). It can start with a letter or Chinese character.

Description

Specify a description for the pending component icon, a string of 0 to 128 characters.

Configuration Information

  • Wait Timer—Set the wait timer.

  • Unit—Specify the wait timer unit.

 

Configure the scripts component icon

Drag-and-drop the scripts component icon to the canvas, click the icon, and then edit the attributes for it in the configuration pane to the right of the page. With a script component icon, you can define custom scripts to implement specific logics. Java scripts are supported. For how to write scripts, see the script usage guide.

Attribute

Description

Name

Specify a name for the scripts component icon, a string of 1 to 64 characters. The value can contain Chinese characters, letters, digits, dots (.), hyphens (-), and underlines (_). It can start with a letter or Chinese character.

Description

Specify a description for the scripts component icon, a string of 0 to 128 characters.

Configuration Information

Use the sample script as a reference or see the script usage guide.

 

Configure interface attributes

Configure basic settings

Parameter

Description

Name

Specify an API name.

When you bind a policy to an API or subscribe to an API, you can select an API by its name.

Description

Specify an API description.

API Info

Start Icon

Select a component icon as the start icon.

Method

Select a request method, GET or POST.

Input Parameters

  • Header—Select a header function.

  • Query—Select a query function.

Output Parameters

Select output parameters.

 

Configure global contexts

  1. Click Add Variable.

  1. In the dialog box that opens, configure the parameters as required, and then click OK.

  1. Click Add Global Constant.

  1. In the dialog box that opens, configure the parameters as required, and then click OK.

Parameter

Description

Name

Specify a name for the variable.

Data Type

Select a data type. Options include Text, Digit, Integer, Boollean, Arrary, and Object.

Value

Specify the default value.

Description

Specify a description for the custom variable.

Preview data

To preview the configured variables, click the Data Preview tab.