数据源
获取数据源列表
按数据源 ID 升序列出知识库的数据源。每个数据源附带其定时同步设置、最近一次完成的同步或导入,以及当前运行;没有正在进行的运行时,改为附带最近一次同步。
数据源的删除请求一经受理,该数据源就不再出现在此列表中。
如何启动和跟踪同步,详见 同步数据源与定时同步。
GET
/
knowledge-fs
/
spaces
/
{knowledge_base_id}
/
sources
获取数据源列表
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"connection_id": "c3d4e5f6-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"created_at": "2026-09-01T08:00:00Z",
"credential_configured": null,
"id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"last_synced_at": "2026-09-05T10:12:00Z",
"metadata": {
"client_request_id": "source-20260907-0001",
"providerKind": "website",
"tenantId": "2f1e0d9c-8b7a-4695-8473-2a1b0c9d8e7f"
},
"name": "Docs site",
"permission_scope": [],
"status": "active",
"sync_policy": {
"created_at": "2026-09-01T08:05:00Z",
"custom_interval_seconds": null,
"enabled": true,
"expected_source_version": 7,
"id": "8e7d6c5b-4a39-4f28-9e17-0d1c2b3a4f5e",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"mode": "interval",
"next_run_at": "2026-09-06T10:00:00Z",
"revision": 2,
"source_id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"updated_at": "2026-09-05T10:00:00Z"
},
"sync_workflow": {
"canceled_at": null,
"checkpoint": "source-committed",
"completed_at": "2026-09-05T10:12:00Z",
"created_at": "2026-09-05T10:00:00Z",
"cursor": "ss1:eyJmaW5nZXJwcmludCI6IjgxZDk5OWY4YjI4ZDZhMGFlMTVmNjQxYzE2NjE3ZWNlMTBjYTcxMzE3OWU1MmVhMTYwODYyMzExMDcyYmQ4YmUiLCJraW5kIjoid2Vic2l0ZSIsIm9mZnNldCI6MCwicGhhc2UiOiJlb2YiLCJwcm9ncmVzc0NvbXBsZXRlZCI6NDUsInByb2dyZXNzVG90YWwiOjQ1fQ",
"execution_attempts": 1,
"failure": null,
"id": "d4c3b2a1-6f5e-4d7c-8b9a-0f1e2d3c4b5a",
"kind": "sync",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"last_error_code": null,
"max_execution_attempts": 5,
"progress_completed": 45,
"progress_failed": 0,
"progress_skipped": 0,
"progress_total": 45,
"source_id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"state": "completed",
"updated_at": "2026-09-05T10:12:00Z"
},
"type": "web",
"updated_at": "2026-09-03T09:20:00Z",
"uri": "https://docs.example.com",
"version": 7
}
],
"next_cursor": null
}
Authorizations
Path Parameters
知识库 ID:即知识库 API 访问 对话框中所示服务 API 端点的最后一段(…/knowledge-fs/spaces/<knowledge base ID>),也是地址栏中 /datasets/new/ 之后的那一段。
Query Parameters
游标,取自上一页的 next_cursor。
Required string length:
1 - 1000每页数据源数。
Required range:
1 <= x <= 100Was this page helpful?
⌘I
获取数据源列表
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"connection_id": "c3d4e5f6-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"created_at": "2026-09-01T08:00:00Z",
"credential_configured": null,
"id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"last_synced_at": "2026-09-05T10:12:00Z",
"metadata": {
"client_request_id": "source-20260907-0001",
"providerKind": "website",
"tenantId": "2f1e0d9c-8b7a-4695-8473-2a1b0c9d8e7f"
},
"name": "Docs site",
"permission_scope": [],
"status": "active",
"sync_policy": {
"created_at": "2026-09-01T08:05:00Z",
"custom_interval_seconds": null,
"enabled": true,
"expected_source_version": 7,
"id": "8e7d6c5b-4a39-4f28-9e17-0d1c2b3a4f5e",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"mode": "interval",
"next_run_at": "2026-09-06T10:00:00Z",
"revision": 2,
"source_id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"updated_at": "2026-09-05T10:00:00Z"
},
"sync_workflow": {
"canceled_at": null,
"checkpoint": "source-committed",
"completed_at": "2026-09-05T10:12:00Z",
"created_at": "2026-09-05T10:00:00Z",
"cursor": "ss1:eyJmaW5nZXJwcmludCI6IjgxZDk5OWY4YjI4ZDZhMGFlMTVmNjQxYzE2NjE3ZWNlMTBjYTcxMzE3OWU1MmVhMTYwODYyMzExMDcyYmQ4YmUiLCJraW5kIjoid2Vic2l0ZSIsIm9mZnNldCI6MCwicGhhc2UiOiJlb2YiLCJwcm9ncmVzc0NvbXBsZXRlZCI6NDUsInByb2dyZXNzVG90YWwiOjQ1fQ",
"execution_attempts": 1,
"failure": null,
"id": "d4c3b2a1-6f5e-4d7c-8b9a-0f1e2d3c4b5a",
"kind": "sync",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"last_error_code": null,
"max_execution_attempts": 5,
"progress_completed": 45,
"progress_failed": 0,
"progress_skipped": 0,
"progress_total": 45,
"source_id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"state": "completed",
"updated_at": "2026-09-05T10:12:00Z"
},
"type": "web",
"updated_at": "2026-09-03T09:20:00Z",
"uri": "https://docs.example.com",
"version": 7
}
],
"next_cursor": null
}