DocuSign REST API - Convert PDF form fields into D

2019-08-06 10:26发布

问题:

I am using DocuSign REST API for send document for sign. I am using Php Rest Docusign Api class. I want Convert PDF form fields into DocuSign Secure field. I have setdocumenttransformPdfFields as true as per DocuSign Rest Api guide on https://www.docusign.com/p/RESTAPIGuide/Content/REST%20API%20References/Document%20Parameters.htm.

I am sending following information as CURLOPT_POSTFIELDS. My Sending pdf test1.pdf have already eSignSignHere adobe text field. If I try same pdf file from Docusign website, It is working fine. I have tried also with Signature field.

--myboundary
Content-Type: application/json
Content-Disposition: form-data
{  
   "emailSubject":"Doc Subject",
   "emailBlurb":"Doc Blurb",
   "documents":[  
      {  
         "name":"test1.pdf",
         "documentId":"1",
         "transformPdfFields":"true"
      }
   ],
   "status":"sent",
   "recipients":{  
      "signers":[  
         {  
            "routingOrder":"1",
            "recipientId":"1",
            "name":"support",
            "email":"support@varshaawebteam.com",
            "clientUserId":null,
            "defaultRecipient":true
         }
      ]
   }
}
--myboundary
Content-Type:application/pdf
Content-Disposition: file; filename="test1.pdf"; documentid=1

%PDF-1.6
%âãÏÓ
--All Pdf Binary Data here—
%%EOF

--myboundary--

Curl Call with this data gives result also as following:

stdClass Object ( [envelopeId] => 46915426-740a-4ea3-8e68-47843568dadc
[uri] => /envelopes/46915426-740a-4ea3-8e68-47843568dadc [statusDateTime]
=> 2014-12-11T11:20:02.2700000Z [status] => sent )

回答1:

You can get this working with composite templates. Here is some sample JSON that would replace your existing JSON.

{
    "emailSubject": "Doc Subject",
    "emailBlurb": "Doc Blurb",
    "status": "sent",
    "compositeTemplates": [
        {
            "inlineTemplates": [
                {
                    "sequence": "1",
                    "recipients": {
                        "signers": [
                            {
                                "email": "support@varshaawebteam.com",
                                "name": "support",
                                "recipientId": "1",
                                "defaultRecipient": "true",
                            }
                        ]
                    }
                }
            ],
            "document": {
                "name": "test1.pdf",
                "documentId": "1",
                "transformPdfFields": "true"
            }
        }
    ]
}

Documentation for composite REST templates can be found here: DocuSign REST v2 API Guide - Composite Templates