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

如何通过Smartsheet API的cURL请求为工作表或行附加URL?

使用cURL调用Smartsheet API添加普通URL附件

问题说明

需要通过cURL调用Smartsheet API,给工作表或工作表中的行附加普通URL。官方文档仅提供了文件附件的调用示例,自行调整请求头和请求体时因格式错误失败。

Smartsheet官方文档说明

为工作表附加文件或URL
将文件附加到工作表。URL可以是以下类型之一:

  • 普通URL(attachmentType "LINK")
  • Box.com URL(attachmentType "BOX_COM")
  • Dropbox URL(attachmentType "DROPBOX")

官方提供的文件附件示例仅作参考(不适用于URL附件):

curl https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments \
-H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \
-H "Content-Type: application/msword" \
-H 'Content-Disposition: attachment; filename="ProgressReport.docx"' \
-H "Content-Length: FILE_SIZE" \
-X POST \
--data-binary @ProgressReport.docx

正确的URL附件cURL调用示例

给工作表添加普通URL附件

curl https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments \
-H "Authorization: Bearer 你的API令牌" \
-H "Content-Type: application/json" \
-X POST \
-d '{
  "attachmentType": "LINK",
  "name": "自定义链接显示名称",
  "url": "https://your-target-url.com"
}'

给指定行添加普通URL附件

只需修改API路径,添加行ID参数即可:

curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/attachments \
-H "Authorization: Bearer 你的API令牌" \
-H "Content-Type: application/json" \
-X POST \
-d '{
  "attachmentType": "LINK",
  "name": "行专属链接名称",
  "url": "https://your-row-specific-url.com"
}'

关键注意事项

  • 替换{sheetId}为目标工作表的实际ID,{rowId}为目标行的实际ID
  • 将你的API令牌替换为自己的Smartsheet授权令牌
  • name字段为链接在Smartsheet中的显示名称,可根据需求自定义
  • 确保你的API令牌拥有目标工作表的编辑权限

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 10:06:11