# HTTP request

{% hint style="info" %}

### 集成-HTTP request组件

{% endhint %}

<figure><img src="/files/Bg0cmu6ysbvNoEjRmHiE" alt="" width="298"><figcaption></figcaption></figure>

{% hint style="info" %}
HTTP request是允许你向第三方服务发送 HTTP 请求的。

它拥有常用的请求方式：如：get，post，put，delete等等。
{% endhint %}

<figure><img src="/files/OAyNmGeaJvDTrVAB3542" alt="" width="375"><figcaption></figcaption></figure>

{% hint style="info" %}
HTTP request是一个高级功能，因为您需要了解更多有关的 HTTP 请求参数的信息。&#x20;

许多服务都提供 API。 您可以根据提供的API 文档。为 HTTP 请求组件添加参数，它会从第 3 方服务的服务器中，返回不同的response。
{% endhint %}

### **Query params**

1、你可以使用get或者post等请求，在这里填写对应的入参

<figure><img src="/files/z3RY81u01SkAyX8prdMK" alt="" width="375"><figcaption></figcaption></figure>

2、你可以点击 + Add a param 新增一个入参输入框

<figure><img src="/files/0SAVARMZkDWmV0vNkGqJ" alt="" width="375"><figcaption></figcaption></figure>

###

### Headers

1、在这里，你可以填写对应的header数据，比如所需要的token等等

<figure><img src="/files/lZ8HgsgCv6YWwoFXdGLA" alt="" width="375"><figcaption></figcaption></figure>

### **Body - Custom body**

您可以在这里填写body相关的数据，以及变量，又或者设置自定义函数。

```javascript
{
  "name": "{{Name}}",
  "email": "{{Email}}"
}

```

<figure><img src="/files/dGOgnJeBXmhWWro4GY6m" alt="" width="375"><figcaption></figcaption></figure>

###

### 示例

假如你需要用变量的形式，添加一个入参，操作如图：

<figure><img src="/files/IYe4HvH0Hdb9oCOB8XWR" alt="" width="454"><figcaption></figcaption></figure>

然后，我们可以为变量设置一个测试值（该按钮仅在“测试请求”时，才会用该值替换变量）

<figure><img src="/files/MUeEKxuT5tBzKBqGWSKg" alt="" width="449"><figcaption></figcaption></figure>

然后点击“测试请求”按钮，我们可以将结果保存在多个变量中

<figure><img src="/files/ltQZkozKAMmN8mDRNjsw" alt="" width="446"><figcaption></figcaption></figure>

然后我们可以使用这些变量在下一个气泡中显示动态内容：

<figure><img src="/files/ciriOQQH1a7NRLNjDwe2" alt="" width="464"><figcaption></figcaption></figure>

您可以随意调用任何 API 并获取您想要的任何数据。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.nyai.chat/jin-jie-jiao-cheng-gong-zuo-liu/ji-cheng-zu-jian/http-request.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
