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

使用Autodesk Design Automation API与Dropbox转换DWG至PDF遇请求错误

解决Design Automation API结合Dropbox时的Header格式错误问题

你遇到的核心问题是Design Automation API要求请求头的Value必须是原始字符串类型,但你直接传入了JSON对象,导致解析器报错。Dropbox API的Dropbox-API-Arg确实需要JSON格式的参数,但在Design Automation的配置里,你得把这个JSON对象转换成转义后的字符串形式,而不是直接嵌套对象。

错误原因分析

你收到的报错信息已经明确指出问题:

An unexpected 'StartObject' node was found for property named 'Value' when reading from the JSON reader. A 'PrimitiveValue' node was expected.

系统期望Value是一个原始值(比如字符串),但你传入了一个JSON对象(StartObject)。单独调用Dropbox API时可以直接传对象,但Design Automation的Header参数只接受字符串类型的Value。

修正后的WorkItem请求JSON

把Dropbox-API-Arg的Value转换成转义后的字符串即可,以下是修正后的完整请求体:

{
  "Arguments": {
    "InputArguments": [
      {
        "Resource": "https://content.dropboxapi.com/2/files/download",
        "Name": "HostDwg",
        "Headers": [
          {
            "Name": "Authorization",
            "Value": "Bearer xxxxxxxxxxxxxxxxxxxxxxxx"
          },
          {
            "Name": "Dropbox-API-Arg",
            "Value": "{\"path\":\"/original.dwg\"}"
          }
        ]
      }
    ],
    "OutputArguments": [
      {
        "Name": "Result",
        "HttpVerb": "PUT",
        "Resource": "https://content.dropboxapi.com/2/files/upload",
        "StorageProvider": "Generic",
        "Headers": [
          {
            "Name": "Authorization",
            "Value": "Bearer xxxxxxxxxxxxxx"
          },
          {
            "Name": "Dropbox-API-Arg",
            "Value": "{\"path\":\"/test.pdf\",\"mode\":\"add\",\"autorename\":true,\"mute\":false}"
          },
          {
            "Name": "Content-Type",
            "Value": "application/octet-stream"
          }
        ]
      }
    ]
  },
  "ActivityId": "PlotToPDF",
  "Id": ""
}

关键修改点

  1. Dropbox-API-Arg的Value转成字符串:把原来的{"path":"/original.dwg"}改成"{\"path\":\"/original.dwg\"}",用转义的双引号包裹JSON内容,确保它是一个合法的字符串值。
  2. 补充上传接口的Content-Type:Dropbox的文件上传接口需要指定Content-Type: application/octet-stream,之前的请求里缺失了这个头,加上它能避免额外的上传错误。
  3. 完善Dropbox上传参数(可选):在Dropbox-API-Arg里添加mode、autorename等参数,避免目标文件已存在时的报错,比如示例里的{"path":"/test.pdf","mode":"add","autorename":true,"mute":false}。

额外注意事项

  • 确保你的Dropbox Access Token拥有文件读取和写入的权限(scopes需要包含files.content.read和files.content.write)。
  • 确认ActivityId: "PlotToPDF"是你已部署或官方提供的合法活动ID,该活动需要能正确处理DWG转PDF的逻辑。
  • 检查输入的DWG文件路径是否正确,Dropbox的路径区分大小写,且根路径以/开头。

这样修改后,Design Automation API就能正确解析请求头,顺利调用Dropbox的下载和上传接口完成转换了。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.29 09:00:24