创建信封时,DocuSign INVALID
我正在将accesstoken与文档数据一起发送,但出现此错误。我是否以正确的顺序发送文档数据
bodyData = {
"status": "sent",
"emailSubject": "Sent from the DocuSign REST API",
"documents": [{
"documentId": "1",
"name": "contract.pdf",
"documentBase64": "base64 document bytes...",
}],
"recipients": {
"signers": [{
"email": "....",
"name": "Jane Dough",
"recipientId": "....",
"routingOrder": "1",
}]
}
}
curl.setHeaders([
`Authorization: Bearer ${auth}`,
"Content-Type: application/x-www-form-urlencoded"
])
.setBody(bodyData)
.post(`/${accountId}/envelopes`)
.then(({ statusCode, body, headers }) => {
console.log('body : ', body)
return res.status(200).json({
success: true,
data: body
});
})
.catch(e => {
console.log(e);
});
} catch (err) {
console.log("err : ", err);
// next(Boom.badImplementation(err));
}
回答如下:需要将content_type更改为application / json
此外,还需要确保在请求中发送正确的正文。
我也建议您考虑使用eSig REST API的最新版本2.1
在此处查看此API的文档-https://developers.docusign/esign-rest-api/reference/Envelopes/Envelopes/create