Skip to content

Commit fc6af19

Browse files
authored
Doc: Added an HTTP request component reference (#12141)
### Type of change - [x] Documentation Update
1 parent 0588fe7 commit fc6af19

File tree

1 file changed

+90
-0
lines changed
  • docs/guides/agent/agent_component_reference

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
sidebar_position: 30
3+
slug: /http_request_component
4+
---
5+
6+
# HTTP request component
7+
8+
A component that calls remote services.
9+
10+
---
11+
12+
An **HTTP request** component lets you access remote APIs or services by providing a URL and an HTTP method, and then receive the response. You can customize headers, parameters, proxies, and timeout settings, and use common methods like GET and POST. It’s useful for exchanging data with external systems in a workflow.
13+
14+
## Prerequisites
15+
16+
- An accessible remote API or service.
17+
- Add a Token or credentials to the request header, if the target service requires authentication.
18+
19+
## Configurations
20+
21+
### Url
22+
23+
*Required*. The complete request address, for example: http://api.example.com/data.
24+
25+
### Method
26+
27+
The HTTP request method to select. Available options:
28+
29+
- GET
30+
- POST
31+
- PUT
32+
33+
### Timeout
34+
35+
The maximum waiting time for the request, in seconds. Defaults to `60`.
36+
37+
### Headers
38+
39+
Custom HTTP headers can be set here, for example:
40+
41+
```http
42+
{
43+
"Accept": "application/json",
44+
"Cache-Control": "no-cache",
45+
"Connection": "keep-alive"
46+
}
47+
```
48+
49+
### Proxy
50+
51+
Optional. The proxy server address to use for this request.
52+
53+
### Clean HTML
54+
55+
`Boolean`: Whether to remove HTML tags from the returned results and keep plain text only.
56+
57+
### Parameter
58+
59+
*Optional*. Parameters to send with the HTTP request. Supports key-value pairs:
60+
61+
- To assign a value using a dynamic system variable, set it as Variable.
62+
- To override these dynamic values under certain conditions and use a fixed static value instead, Value is the appropriate choice.
63+
64+
65+
:::tip NOTE
66+
- For GET requests, these parameters are appended to the end of the URL.
67+
- For POST/PUT requests, they are sent as the request body.
68+
:::
69+
70+
#### Example setting
71+
72+
![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/http_settings.png)
73+
74+
#### Example response
75+
76+
```html
77+
{ "args": { "App": "RAGFlow", "Query": "How to do?", "Userid": "241ed25a8e1011f0b979424ebc5b108b" }, "headers": { "Accept": "/", "Accept-Encoding": "gzip, deflate, br, zstd", "Cache-Control": "no-cache", "Host": "httpbin.org", "User-Agent": "python-requests/2.32.2", "X-Amzn-Trace-Id": "Root=1-68c9210c-5aab9088580c130a2f065523" }, "origin": "185.36.193.38", "url": "https://httpbin.org/get?Userid=241ed25a8e1011f0b979424ebc5b108b&App=RAGFlow&Query=How+to+do%3F" }
78+
```
79+
80+
### Output
81+
82+
The global variable name for the output of the HTTP request component, which can be referenced by other components in the workflow.
83+
84+
- `Result`: `string` The response returned by the remote service.
85+
86+
## Example
87+
88+
This is a usage example: a workflow sends a GET request from the **Begin** component to `https://httpbin.org/get` via the **HTTP Request_0** component, passes parameters to the server, and finally outputs the result through the **Message_0** component.
89+
90+
![](https://raw.githubusercontent.com/infiniflow/ragflow-docs/main/images/http_usage.PNG)

0 commit comments

Comments
 (0)