RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

    • Standard Components Overview
    • filter

    • action

    • transform

    • external

      • restApiCall
        • Configuration
        • Relation Type
        • Execution result
        • Configuration example
        • Application example
      • mqttClient
      • sendEmail
      • dbClient
      • ssh
      • net
    • flow

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

目录

restApiCall

restApiCall component: call rest api. Call an external REST service. msg.Data will be filled in the body and request the REST service, and the request return value will be filled back to msg.Data.

# Configuration

Field Type Description Default value
restEndpointUrlPattern string HTTP URL address, can using Component Configuration Variables. None
requestMethod string Request method POST
withoutRequestBody bool without request body false
headers map Request header, can using Component Configuration Variables. "Content-Type": "application/json"
readTimeoutMs int Timeout, in milliseconds 2000
insecureSkipVerify v0.27.0+ bool whether a client verifies the server's certificate false
maxParallelRequestsCount int Maximum concurrency size 200
enableProxy bool Whether to enable proxy false
useSystemProxyProperties bool Whether to use system configuration proxy false
proxyHost string Proxy host None
proxyPort int Proxy port None
proxyUser string Proxy username None
proxyPassword string Proxy password None
proxyScheme string Proxy protocol None

Placeholder

restEndpointUrlPattern and headers support using ${metaKeyName} to replace metadata data. (Note: ${} cannot contain spaces)

# Relation Type

  • Success: Execution successful, send the message to the Success chain
  • Failure: Execution failed, send the message to the Failure chain

# Execution result

  • Execution successful: http response body data, replace to msg.Data, and pass to the next node
    • msg.Metadata.status: Save the response code.
    • msg.Metadata.statusCode: Save the response code.
  • Execution failed:
    • msg.Metadata.status: Save the response code.
    • msg.Metadata.statusCode: Save the response code.
    • msg.Metadata.errorBody: Response error information.

# Configuration example

  {
  "id": "s1",
  "type": "restApiCall",
  "name": "Push data",
  "configuration": {
    "restEndpointUrlPattern": "http://192.168.136.26:9099/api/msg",
    "requestMethod": "POST",
    "maxParallelRequestsCount": 200
  }
}
1
2
3
4
5
6
7
8
9
10

You can also call large model streaming responses in the following way:

 {
    "id": "s2",
    "type": "restApiCall",
    "name": "Call restApi",
    "configuration": {
      "restEndpointUrlPattern": "http://127.0.0.1:8080/sse",
        "requestMethod":"GET",
      "headers":{"Accept":"text/event-stream"},
      "maxParallelRequestsCount": 200
    }
  }
1
2
3
4
5
6
7
8
9
10
11

# Application example

Call rest api.

{
  "ruleChain": {
    "id":"rule01",
    "name": "Test rule chain",
    "root": true
  },
  "metadata": {
    "nodes": [
       {
        "id": "s1",
        "type": "jsTransform",
        "name": "Transform",
        "configuration": {
          "jsScript": "metadata['name']='test02';\n metadata['index']=22;\n msg['addField']='addValue2'; return {'msg':msg,'metadata':metadata,'msgType':msgType};"
        }
      },
      {
        "id": "s2",
        "type": "restApiCall",
        "name": "Push data",
        "configuration": {
          "restEndpointUrlPattern": "http://192.168.136.26:9099/api/msg",
          "requestMethod": "POST",
          "maxParallelRequestsCount": 200
        }
      }
    ],
    "connections": [
      {
        "fromId": "s1",
        "toId": "s2",
        "type": "Success"
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Edit this page on GitHub (opens new window)
Last Updated: 2025/04/02, 01:29:50
text/template
mqttClient

← text/template mqttClient→

Theme by Vdoing | Copyright © 2023-2025 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式