网页搜索
POST
/api/search/webSearch根据关键词搜索网络,返回相关网页的标题、摘要和链接。结果以大模型友好的结构化格式返回,适用于 AI Agent、RAG 等场景。
请求参数
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
keywords | String | 是 | - | 搜索关键词 |
num | Integer | 否 | 10 | 返回结果数量 |
请求示例
curl -X POST https://platform.iflow.cn/api/search/webSearch \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"keywords": "Java Spring Boot 教程",
"num": 2
}'
响应示例
{
"success": true,
"code": "200",
"message": "操作成功",
"exception": null,
"data": {
"organic": [
{
"title": "Spring Boot开发- Java教程- 廖雪峰的官方网站",
"link": "https://liaoxuefeng.com/books/java/springboot/index.html",
"snippet": "Spring Boot是一个基于Spring的套件,它帮我们预组装了Spring的一系列组件,以便以尽可能少的代码和配置来开发基于Spring的Java应用程序。",
"position": 1,
"date": null
},
{
"title": "Java SpringBoot 框架 - 菜鸟教程",
"link": "https://www.runoob.com/java/java-springboot-framework.html",
"snippet": "Java SpringBoot 框架 · 1. 使用Spring Initializr 创建项目. 访问start.spring.io,选择:. Maven 项目 · 2. 项目结构. 典型的SpringBoot 项目结构: · 3. 编写简单REST 控制 ...",
"position": 2,
"date": null
}
],
"query": "Java Spring Boot 教程"
},
"extra": null
}
响应字段说明
data 对象
| 字段 | 类型 | 说明 |
|---|---|---|
organic | Array | 搜索结果列表 |
query | String | 实际搜索的关键词 |
organic 数组中的每个对象
| 字段 | 类型 | 说明 |
|---|---|---|
title | String | 网页标题 |
link | String | 网页链接 |
snippet | String | 搜索结果摘要 |
position | Integer | 结果排序位置 |
date | String | 网页发布日期(可能为空) |