跳到主要内容

网页搜索

POST
/api/search/webSearch

根据关键词搜索网络,返回相关网页的标题、摘要和链接。结果以大模型友好的结构化格式返回,适用于 AI Agent、RAG 等场景。


请求参数

字段类型必填默认值说明
keywordsString-搜索关键词
numInteger10返回结果数量

请求示例

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 对象

字段类型说明
organicArray搜索结果列表
queryString实际搜索的关键词

organic 数组中的每个对象

字段类型说明
titleString网页标题
linkString网页链接
snippetString搜索结果摘要
positionInteger结果排序位置
dateString网页发布日期(可能为空)