All Products
Search
Document Center

Logic Composer:Create a custom HTTP service

Last Updated:Jan 17, 2023

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

  1. 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.

  2. In the Select Trigger window on the Graphic View tab, click the All tab and then click Request.

  3. 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.

  4. Click + Add Step. The Select Action window is displayed. Click the All tab and then click Request.

  5. In the Request dialog box that appears, click Response on the Actions tab.

  6. In the Response dialog box that appears, enter Content-Type and application/json for Header, and then click the Body input box to enter the following codes:

    {
      "ip": "@{triggerOutputs().headers['x-true-ip']}"
    }
  7. When the configuration is complete, click Save.

  8. Click When a HTTP request is received to expand the dialog box. Then, click Copy under HTTP Endpoint.

  9. Open the address in a new browser window. The IP address of the visitor is displayed. image

Note

For more information about the limits on the custom request trigger, see Limits.