数据源
List data sources
返回指定数据集中的数据源列表。使用此接口时,请注意:
- 确保指定数据集和您的 API Key 归属于同一项目。 - 如需查看您在该项目中有访问权限的数据集,请调用 GET /v2/team/datasets 接口。
GET
/
v2
/
team
/
datasets
/
{id}
/
datasources
List data sources
curl --request GET \
--url https://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources \
--header 'x-pd-api-key: <api-key>'import requests
url = "https://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources"
headers = {"x-pd-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-pd-api-key': '<api-key>'}};
fetch('https://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources', 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://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-pd-api-key: <api-key>"
],
]);
$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://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-pd-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources")
.header("x-pd-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-pd-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"total_items": 1,
"page_size": 10,
"page_number": 1,
"records": [
{
"id": "datasource-cadsgfsdagasgadsg",
"dataset_id": "dataset-dagasdgasgasg",
"name": "test.csv",
"type": "FILE",
"status": "synching"
}
]
}
}请求示例:
返回示例:
curl --request GET \
--url https://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources?user_id=tmm-dafasdfasdfasdf \
--header 'x-pd-api-key: <api-key>'
import requests
url = "https://app.ai.relyt.cn/app/api/v2/team/datasets/{id}/datasources?user_id=tmm-dafasdfasdfasdf"
headers = {"x-pd-api-key": "<api-key>"}
response = requests.request("GET", url, headers=headers)
print(response.text)
200
{
"code": 0,
"data": {
"total_items": 1,
"page_size": 10,
"page_number": 1,
"records": [
{
"id": "datasource-cadsgfsdagasgadsg",
"dataset_id": "dataset-dagasdgasgasg",
"name": "test.csv",
"type": "FILE",
"status": "synching"
}
]
}
}
Authorizations
Headers
您本地系统中设置的 Trace ID,至多支持 128 个字符。当请求发生错误时,可以将此 ID 提供给 Relyt AI 团队,协助进行故障排查。
Path Parameters
目标数据集 ID。
如需查询您有访问权限的数据集列表,请调用 GET /v2/team/datasets 接口。
Query Parameters
分页返回的起始页码。如不指定,则使用默认值 1。
每页返回的记录数量。如不指定,则使用默认值 10。
数据源状态。指定该参数后,只有处于指定状态的数据源才会被返回。可选值包括:
invalid:等待处理中。synching:正在处理中。synched:已成功同步。
如果未指定,将返回所有数据源。
可以通过英文逗号分隔的列表指定多个状态,匹配任何状态的数据源将被返回。
Available options:
synching, invalid, synched 用户 ID,即您在组织中的唯一身份标识。