Search code examples
delphidocusignapichilkat

Chilkat Docusign : Error The input is not a valid Base-64 string


Delphi 10 Seattle
IntraWeb 15.0.23
Chilkat Trial

Used Chilkat (Delphi DLL) PDF File Encoding to Base64 to Encode my file.

https://www.example-code.com/delphidll/base64_pdf.asp

While parsing it to the Chilkat Delphi DLL code to request remote signing I get the below mentioned response.

https://www.example-code.com/delphidll/docusign_request_signature_via_email.asp

Please see Response code while trying to send a file through the Docusign API. I have the PDF to base64 code working and vice versa.

Response Status Code = 400
Response Header:
Cache-Control: no-cache
Content-Length: 226
Content-Type: application/json; charset=utf-8
Date: Wed, 27 May 2020 12:12:16 GMT
Response Body:
{
  "errorCode": "UNSPECIFIED_ERROR",
  "message": "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "
}
Response Body End
Request Body:
{"emailSubject":"DocuSign REST API Quickstart Sample","emailBlurb":"Shows how to create and send an envelope from a document.","recipients":{"signers":[{"email":"[email protected]","name":"XYZ","recipientId":"1","routingOrder":"1"}]},"documents":[{"documentId":"1","name":"C:\Doe_John.pdf","documentBase64":"JVBERi0xLjQNJabpz8QNCjEgMCBvYmoNPDwvQ3JlYXRvcij+/wBNAGkAYwByAG8AcwBvAGYAdAAgAFcAbwByAGQAIAAtACAARABvAGMAdQBtAGUAbgB0ADEpL1Byb2R1Y2VyKP7/AFMAYwBhAG4AUwBvAGYAdAAgAFAARABGACAAQwByAGUAYQB0AGUAIQAgADUpL0NyZWF0aW9uRGF0ZShEOjIwMDkxMjIyMTUwOTMyLTA1JzAwJykvTW9kRGF0ZShEOjIwMDkxMjIyMTUwOTMzLTA1JzAwJykvQXV0aG9yKP7/AGUAcwBmAG8AeCkvVGl0bGUo/v8ATQBpAGMAcgBvAHMAbwBmAHQAIABXAG8AcgBkACAALQAgAEQAbwBjAHUAbQBlAG4AdAAxKT4+DWVuZG9iag0yIDAgb2JqDTw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAzIDAgUi9QYWdlTW9kZS9Vc2VOb25lL091dGxpbmVzIDcgMCBSL01l驠"}],"status":"sent"}

Solution

  • Your error message is very helpful in this case. Check the validity of your Base64 string - Looks to me like a pipe and mandarin character sitting at the end of your encoded string.

    { "errorCode": "UNSPECIFIED_ERROR", "message": "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. " }