DocuSign REST API - 将PDF表单字段转换为DocuSign安全字段 - 不工作

时间:2014-12-24 11:51:54

标签: php api rest docusignapi

我使用DocuSign REST API发送文件进行签名。我正在使用Php Rest Docusign Api课程。我想将PDF表单字段转换为DocuSign Secure字段。我根据https://www.docusign.com/p/RESTAPIGuide/Content/REST%20API%20References/Document%20Parameters.htm上的DocuSign Rest Api指南将setdocumenttransformPdfFields设置为true。

我发送以下信息为CURLOPT_POSTFIELDS。我发送的pdf test1.pdf已经有了eSignSignHere adobe文本字段。如果我从Docusign网站尝试相同的pdf文件,它工作正常。我也尝试过Signature字段。

--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--

使用此数据进行卷曲调用的结果如下:

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 个答案:

答案 0 :(得分:1)

您可以使用复合模板。以下是一些可替代现有JSON的示例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"
            }
        }
    ]
}

可以在此处找到复合REST模板的文档:DocuSign REST v2 API Guide - Composite Templates