我正在尝试通过REST API创建一个信封,并收到400响应并出现以下错误:
{"errorCode": "INVALID_REQUEST_BODY",
"message": "The request body is missing or improperly formatted. Could not cast or convert from System.String to API_REST.Models.v2.envelopeDefinition."}
请求正在发送至:https://demo.docusign.net/restapi/v2/accounts/<ACCOUNT_ID>/envelopes
请求的正文是:
{
"templateId":"7b3b7724-3309-48bf-a8b4-65414d8686a5",
"status":"created",
"emailSubject":"Test subject: 2017-01-17T08:27:03.214"
}
我能够通过具有以下请求主体的REST API Explorer无问题地创建此请求:
{
"emailSubject": "Test Subject",
"status": "created",
"templateId": "7b3b7724-3309-48bf-a8b4-65414d8686a5"
}
答案 0 :(得分:2)
很奇怪。我试过这个同样的身体并没有遇到任何问题(当然只是更改了TemplateId)。
此外,我尝试删除一些标头(Auth和Content-Type),但错误消息不同。
进入我的脑海:
如果有任何帮助,请告诉我!
答案 1 :(得分:0)
重新发布您的评论作为社区利益的答案。
Actually it turns out that I was sending the body incorrectly via our http client layer. It was being sent as a being serialized twice. Things are working as expected