附件與檔案
建立新附件 (整合)
程式碼範例
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/attachments-upload/" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-F "file=@example_file.pdf"
# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。const axios = require('axios');
const FormData = require('form-data');
// 建立FormData對象
const formData = new FormData();
// 請用實際檔案替換
formData.append('file', /* 實際檔案物件 */, 'example_file.pdf');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
...formData.getHeaders()
}
};
axios.post("https://api.maiagent.ai/api/attachments-upload/", formData, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});回應內容
狀態碼
說明
取得檔案上傳用的預簽署 URL (建立/取得)
參數
參數名稱
必填
類型
說明
請求內容
欄位
類型
必填
說明
程式碼範例
回應內容
Presigned 上傳附件
請求內容
欄位
類型
必填
說明
程式碼範例
回應內容
建立對話附件
參數
參數名稱
必填
類型
說明
請求內容
欄位
類型
必填
說明
程式碼範例
回應內容
Last updated
Was this helpful?
