You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用REST API创建Vertex AI Search数据存储时遇404错误求助

使用REST API创建Vertex AI Search的DataStore时遭遇404错误

我现在找不到解决途径,尝试用REST API为Vertex AI Search(又名Google Enterprise Search/Generative AI App Builder)创建DataStore。我已经按照官方文档操作,尝试创建DataStore并从Cloud Storage导入非结构化数据,认证环节没有问题。根据API文档,该创建方法是有效的,但我却收到了404“方法未找到”的响应。我本来想使用PHP库,但目前暂不支持,所以只能用REST方式实现。

以下是我使用的代码:

$url = 'https://discoveryengine.googleapis.com/v1alpha/projects/xxxxxx/locations/global/collections/default_collection/dataStores?dataStoreId=xxxxxx';

$data = [
    'name' => 'xxxxxx',
    'displayName' => 'xxxxxx',
    'industryVertical' => 'GENERIC',
    'solutionTypes' => ['SOLUTION_TYPE_SEARCH'],
    'contentConfig' => 'CONTENT_REQUIRED',
    'searchTier' => 'ENTERPRISE',
    'searchAddOns' => ['LLM'],
    'companyInfo' => [
        'displayName' => 'xxxxxx'
    ]
];

$headers = [
    'Authorization: Bearer xxxxxx',
    'Content-Type: application/json',
    'X-Goog-User-Project: xxxxxx'
];

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the cURL request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
}

// Close cURL session
curl_close($ch);

我预期这个请求能成功创建Vertex AI Search应用的DataStore。

内容的提问来源于stack exchange,提问作者Conor Cassidy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 08:52:30