Question

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.

Was it helpful?

Solution 2

All you have to do is change $data_string to $data in your code...

Thanks for catching this, I've updated the Gist on the Request Signature page, it should work now.

OTHER TIPS

Yes, this is a bug. I am working on creating a sensible PHP class file derived from that sample code. Here is a class derived from that code which works and is a little cleaner: https://github.com/sylnsr/esign-samples/tree/master/docusign/php -- If you are interested in exploring something other than DocuSign, please feel free to check-in on that project from time to time for other samples for other vendors such as RightSignature which I will be working on next.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top