2

I am following docusign's tutorial to create an envelope using their PHP API. Tutorialis found here: http://www.docusign.com/developer-center/quick-start/request-signatures

I copied the code and downloaded the sample file, and am now getting this response: "errorCode": "UNSPECIFIED_ERROR", "message": "Buffer cannot be null.\r\nParameter name: buffer"

I think the error may be related to this section:

$requestBody = "\r\n"
."\r\n"
."--myboundary\r\n"
."Content-Type: application/json\r\n"
."Content-Disposition: form-data\r\n"
."\r\n"
."$data_string\r\n"
."--myboundary\r\n"
."Content-Type:application/pdf\r\n"
."Content-Disposition: file; filename=\"document.pdf\"; documentid=1 \r\n"
."\r\n"
."$file_contents\r\n"
."--myboundary--\r\n"
."\r\n";

The problem, i think, is that $data_string is not defined anywhere in their example. There is a data definition:

$data = "{
\"emailBlurb\":\"This comes from PHP\",
\"emailSubject\":\"API Signature Request\",
\"documents\":[
{
\"documentId\":\"1\",
\"name\":\"document.pdf\"
}
],
\"recipients\":{
\"signers\":[
{
\"email\":$email,
\"name\":$name,
\"recipientId\":\"1\",
\"tabs\":{
\"signHereTabs\":[
{
\"xPosition\":\"100\",
\"yPosition\":\"100\",
\"documentId\":\"1\",
\"pageNumber\":\"1\"
}
]
}
}
]
},
\"status\":\"sent\"
}";

....But not $data_string.

I tried using the "TEST" as the value for $data_string and got: "errorCode": "INVALID_MULTI_PART_REQUEST", "message": "An error was found while parsing the multipart request. The JSON data in the first part of the multi-part request does not match the expected format. The token 'true' was expected but found 'test'."

I then set the value of $data_string as a boolean (TRUE) and got the following error message: errorCode": "INVALID_MULTI_PART_REQUEST", "message": "An error was found while parsing the multipart request. The JSON data in the first part of the multi-part request does not match the expected format. "

Any help in resolving this is greatly appreciated.

4

2 回答 2

1

是的,这是一个错误。我正在创建一个从该示例代码派生的合理的 PHP 类文件。这是从该代码派生的一个类,它可以工作并且更简洁:https ://github.com/sylnsr/esign-samples/tree/master/docusign/php——如果您有兴趣探索DocuSign以外的东西,请随时检查该项目以获取其他供应商的其他示例,例如我将在接下来进行的 RightSignature。

于 2013-06-19T23:44:57.500 回答
0

您所要做的就是在代码中将 $data_string 更改为 $data ...

感谢您发现这一点,我已经更新了请求签名页面上的要点,它现在应该可以工作了。

于 2013-06-20T05:49:22.767 回答