This topic describes how to create a custom HTTP service by using a template provided by Logic Composer.
Scenarios
Create an HTTP interface to query the IP address of a visitor by using the custom request trigger of Logic Composer. When a visitor accesses the HTTP interface, the IP address of the visitor is displayed.
Procedure
Log on to the Logical Composer console. In the left-side navigation tree, click Workflows and then click Create Workflow. When Created is displayed in the Create Workflow dialog box, select Blank. For more information, see Create a workflow.
In the Select Trigger window on the Graphic View tab, click the All tab and then click Request.
In the Request dialog box that appears, click When a HTTP request is received on the Triggers tab. In the dialog box that appears, select GET for Method.
Click + Add Step. The Select Action window is displayed. Click the All tab and then click Request.
In the Request dialog box that appears, click Response on the Actions tab.
In the Response dialog box that appears, enter
Content-Type
andapplication/json
for Header, and then click the Body input box to enter the following codes:{ "ip": "@{triggerOutputs().headers['x-true-ip']}" }
When the configuration is complete, click Save.
Click When a HTTP request is received to expand the dialog box. Then, click Copy under HTTP Endpoint.
Open the address in a new browser window. The IP address of the visitor is displayed.
For more information about the limits on the custom request trigger, see Limits.