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

使用API向dust(eu.dust.tt)上传文档遇问题,求正确curl命令

Dust平台文档上传失败问题及解决建议

操作背景与报错信息

1. 已执行的GET请求(列出文档)

命令:

curl --request GET --url https://eu.dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents --header 'accept: application/json' --header 'Authorization: Bearer {APIKey}'

返回结果(200 OK):

{
   "total" : 3,
   "documents" : []
}

2. 上传文档的POST请求及错误

命令:

curl --request POST --url https://eu.dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents --header "Authorization: Bearer {APIKey}" -F "file=@File1.csv"

错误响应:

{"error":{"type":"method_not_supported_error","message":"The method passed is not supported, GET is expected."}}

问题分析与解决方案

错误提示明确/documents端点仅支持GET请求,因此上传/更新文档需使用平台提供的专用写入端点,以下是两种可行的命令尝试:

方案1:PUT请求单文件Upsert

若平台支持通过PUT直接创建或覆盖文档,使用此命令:

curl --request PUT \
  --url https://eu.dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents/File1.csv \
  --header "Authorization: Bearer {APIKey}" \
  --header "Content-Type: text/csv" \
  --data-binary @File1.csv

方案2:POST请求批量上传端点

多数数据平台会提供批量文档操作端点,尝试使用/documents/batch路径:

curl --request POST \
  --url https://eu.dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents/batch \
  --header "Authorization: Bearer {APIKey}" \
  -F "files=@File1.csv"

额外检查项

  • 确认目标数据源是否支持CSV格式上传
  • 验证API密钥是否拥有文档写入权限

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.11 12:12:43