我正在關注docusign的教程,使用他們的PHP API創建一個信封。 Tutorialis在這裏找到:http://www.docusign.com/developer-center/quick-start/request-signaturesDocusign教程 - PHP API cURL錯誤 - 「緩衝區不能爲空」
我複製的代碼,並下載示例文件,我現在得到這樣的響應: 「錯誤碼」:「UNSPECIFIED_ERROR」,「消息」:「緩衝區不能爲空\ r \ n參數名:緩衝區」
我認爲錯誤可能與本節:
$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";
的問題,我認爲,是$ data_string沒有在他們的榜樣任何地方所定義。有一個數據定義:
$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\"
}";
....但不是$ data_string。
我嘗試使用「TEST」的值$ data_string並獲得:"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'."
我再設置的$ data_string爲布爾(TRUE)的值,並得到了以下錯誤消息: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. "
任何幫助解決這一問題,非常感謝。
P.S.我還添加了一個檢查以確保文檔ID是一個GUID或一個整數。我注意到,如果您嘗試在JSON中爲「recipientId」使用類似「收件人1」的服務,則服務會返回錯誤消息 –
FYI DocuSign爲其REST API發佈了Java和PHP客戶端庫。看到這裏:https://github.com/docusign/eSignPHPLib – Ergin