DocuSign REST API INVALID_CONTENT_TYPE使用应用程序/ json从模板发送信封

我正在使用Google Apps脚本向https://demo.docusign.net/restapi/v2.1/accounts/ACCOUNT-ID/envelopes发出URL请求(其中accOUNT-ID是我正确的数字帐户ID。)

正在使用代码UrlFetchApp.fetch(url,params)发送。

params

{
  muteHttpExceptions: true,method: "POST",headers: {
    Authorization: "Bearer "+jwt,ContentType: "application/json"
  },payload: payload
}

jwt是在执行时从JWT身份验证流程中检索到的令牌,而payload

{
  "accountId": accountID,"emailSubject": subject,"templateId": templateID,"templateRoles": [{
    "email": data['email'],"name": data['name'],"roleName": "Seller","tabs": {
      "textTabs": [
        {"tabLabel": "Seller","value": data['name']},...
      ]
    }
  }],"status": "sent"
}

此处使用的变量按照与example given by DocuSign

一致的方式进行了预期的定义

执行此操作时,我收到HTTP 415的以下响应。 {"errorCode":"INVALID_CONTENT_TYPE","message":"Content Type specified is not supported."}

我尝试删除ContentType标头,将有效负载作为字符串传递,但一次都无效。我还尝试提供GUID而不是accountID的数字ID,但结果还是一样。

lszhangkun 回答:DocuSign REST API INVALID_CONTENT_TYPE使用应用程序/ json从模板发送信封

内容类型应指定为 -对象中的Content-Type(带有headers)或paramsoptions对象中的contentTypepayload也应JSON.stringify结束。

本文链接:https://www.f2er.com/2736246.html

大家都在问