调用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
相关产品推荐
相关产品推荐

