Knowledge Sources - Upload File
將檔案上傳到檔案知識來源以進行處理與索引。
POST {endpoint}/knowledgesources('{sourceName}')/files?api-version=2026-05-01-preview
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
搜尋服務的端點 URL。 |
|
source
|
path | True |
string |
知識來源的名稱。 |
|
api-version
|
query | True |
string minLength: 1 |
用於此作業的 API 版本。 |
要求標頭
Media Types: "application/octet-stream"
| 名稱 | 必要 | 類型 | Description |
|---|---|---|---|
| Content-Disposition | True |
string |
Content-Disposition 標頭,指定上傳檔案的檔名。
必須遵循格式: |
| x-ms-client-request-id |
string (uuid) |
要求不透明、全域唯一、用戶端產生的字串標識碼。 |
要求本文
Media Types: "application/octet-stream"
| 名稱 | 類型 | Description |
|---|---|---|
| file |
string (binary) |
要上傳的檔案內容。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 201 Created |
要求已成功,因此已建立新的資源。 |
|
| Other Status Codes |
未預期的錯誤回應。 |
安全性
api-key
類型:
apiKey
位於:
header
OAuth2Auth
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
範圍
| 名稱 | Description |
|---|---|
| https://search.azure.com/.default |
範例
SearchServiceUploadKnowledgeSourceFile
範例要求
POST https://previewexampleservice.search.windows.net/knowledgesources('ks-file-test')/files?api-version=2026-05-01-preview
"dGVzdCBmaWxlIGNvbnRlbnQ="
範例回覆
{
"fileId": "00000000-0000-0000-0000-000000000001",
"fileName": "example.pdf",
"fileSizeBytes": 12345,
"createdAt": "2026-01-01T00:00:00Z",
"lastUpdatedAt": "2026-01-01T00:00:00Z",
"errorMessage": null
}
定義
| 名稱 | Description |
|---|---|
|
Error |
資源管理錯誤其他資訊。 |
|
Error |
錯誤詳細資料。 |
|
Error |
所有 Azure Resource Manager API 的常見錯誤回應,以傳回失敗作業的錯誤詳細數據。 (這也遵循 OData 錯誤回應格式。)。 |
|
Knowledge |
上傳到檔案知識來源的檔案元資料。 |
ErrorAdditionalInfo
資源管理錯誤其他資訊。
| 名稱 | 類型 | Description |
|---|---|---|
| info |
其他資訊。 |
|
| type |
string |
其他信息類型。 |
ErrorDetail
錯誤詳細資料。
| 名稱 | 類型 | Description |
|---|---|---|
| additionalInfo |
錯誤的其他資訊。 |
|
| code |
string |
錯誤碼。 |
| details |
錯誤詳情 |
|
| message |
string |
錯誤訊息。 |
| target |
string |
錯誤目標。 |
ErrorResponse
所有 Azure Resource Manager API 的常見錯誤回應,以傳回失敗作業的錯誤詳細數據。 (這也遵循 OData 錯誤回應格式。)。
| 名稱 | 類型 | Description |
|---|---|---|
| error |
error 物件。 |
KnowledgeSourceFile
上傳到檔案知識來源的檔案元資料。
| 名稱 | 類型 | Description |
|---|---|---|
| createdAt |
string (date-time) |
檔案建立的時間戳。 |
| errorMessage |
string |
如果檔案處理失敗,則顯示錯誤訊息,否則為 null。 |
| fileId |
string |
檔案的唯一識別碼。 |
| fileName |
string |
原始檔案名稱。 |
| fileSizeBytes |
integer (int64) |
檔案大小 (以位元組為單位)。 |
| lastUpdatedAt |
string (date-time) |
檔案最後更新的時間戳。 |