我正在使用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,但结果还是一样。