调用 CreateEnvelope 时出错:TAB_PAGE_NUMBER_NOT_SPECIFIED

Error calling CreateEnvelope : TAB_PAGE_NUMBER_NOT_SPECIFIED

我是 DocuSign API 编程的初学者。我有一个 .cshtml 页面用于创建发送给客户的信封。当我尝试从 DocuSign API 创建信封时,它显示如下错误消息:

Page number not specified in tab element. Page Number or AnchorTabItem missing for tab \"SignHere\"."

请查看我的 HTML 和下面的代码。

Html

 <span>
         <br />
           <br />
<span><b>SIGNATURE:</b></span> <span style="color:white;">pleasesignhereBP</span>
                <br />
                <br />
      <span><b>DATE:</b></span><span style="color:white;">pleasedatehereBP</span>
                <br />
                <br />
            </span>

代码

SignerModel objPerson = new SignerModel();

            TabsModel objPersonTab = new TabsModel();
            List<SignHereModel> lstPersonSignHere = new List<SignHereModel>();
            SignHereModel objPersonSignHere = new SignHereModel();
            objPersonSignHere.DocumentId = "1";
            objPersonSignHere.PageNumber = "1";
            objPersonSignHere.RecipientId = "2";
            objPersonSignHere.AnchorString = "pleasesignhereBP";
            objPersonSignHere.AnchorXOffset = ".2";
            objPersonSignHere.AnchorYOffset = ".01";
            objPersonSignHere.AnchorIgnoreIfNotPresent = "true";
            objPersonSignHere.AnchorUnits = "cms";
            lstPersonSignHere.Add(objPersonSignHere);
            objPersonTab.SignHereTabs = lstPersonSignHere;

            List<DateModel> lstPersonDateHere = new List<DateModel>();
            DateModel objPersonDate = new DateModel();
            objPersonDate.DocumentId = "1";
            objPersonDate.PageNumber = "1";
            objPersonDate.RecipientId = "1";
            objPersonDate.AnchorString = "pleasedatehereBP";
            objPersonDate.AnchorXOffset = ".2";
            objPersonDate.AnchorYOffset = ".01";
            objPersonDate.AnchorIgnoreIfNotPresent = "true";
            objPersonDate.AnchorUnits = "cms";
            objPersonDate.Value = DateTime.Now.ToShortDateString();
            lstPersonDateHere.Add(objPersonDate);
            objPersonTab.DateTabs = lstPersonDateHere;

            objPerson.Tabs = objPersonTab;

我已经添加了 objPersonDate.PageNumber = "1" 但它不起作用。

更新

我的项目解决方案中有 DocuSign.eSign 库。我将这个项目称为我的网络应用程序。然后我对 DocuSignCommunicator class 的 SetDocuSignSigners 函数 做了一些更改。

objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";

请看我下面的详细代码。

    private List<Signer> SetDocuSignSigners(List<SignerModel> lstSignerModel)
    {
        List<Signer> lstSigner = new List<Signer>();
        if (lstSignerModel != null && lstSignerModel.Count > 0)
        {
            foreach (SignerModel objModel in lstSignerModel)
            {
                Signer objSigner = new Signer();
                objSigner.Name = objModel.Name;
                objSigner.Email = objModel.Email;
                objSigner.RecipientId = objModel.RecipientId;
                objSigner.RoutingOrder = objModel.RoutingOrder;
                Tabs objTab = new Tabs();
                List<SignHere> lstSalesSignHere = new List<SignHere>();
                List<DateSigned> lstSalesDateHere = new List<DateSigned>();
                List<FullName> lstSalesNameHere = new List<FullName>();

                if (objModel.Tabs != null)
                {
                    if (objModel.Tabs.SignHereTabs != null && objModel.Tabs.SignHereTabs.Count > 0)
                    {
                        foreach (SignHereModel objSignHere in objModel.Tabs.SignHereTabs)
                        {
                            SignHere objSHere = new Model.SignHere();
                            objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";
                            objSHere.AnchorString = objSignHere.AnchorString;
                            objSHere.DocumentId = objSignHere.DocumentId;
                            objSHere.RecipientId = objSignHere.RecipientId;
                            objSHere.AnchorXOffset = objSignHere.AnchorXOffset;
                            objSHere.AnchorYOffset = objSignHere.AnchorYOffset;
                            objSHere.AnchorUnits = objSignHere.AnchorUnits;
                            objSHere.AnchorIgnoreIfNotPresent = objSignHere.AnchorIgnoreIfNotPresent;
                            objSHere.AnchorMatchWholeWord = "true";
                            lstSalesSignHere.Add(objSHere);
                        }
                    }

                    if (objModel.Tabs.DateTabs != null && objModel.Tabs.DateTabs.Count > 0)
                    {
                        foreach (DateModel objDateHere in objModel.Tabs.DateTabs)
                        {
                            DateSigned objDSHere = new DateSigned();
                            objDSHere.PageNumber = (!string.IsNullOrEmpty(objDSHere.PageNumber)) ? objDSHere.PageNumber : "1"; 
                            objDSHere.AnchorString = objDateHere.AnchorString;
                            objDSHere.DocumentId = objDateHere.DocumentId;
                            objDSHere.RecipientId = objDateHere.RecipientId;
                            objDSHere.AnchorXOffset = objDateHere.AnchorXOffset;
                            objDSHere.AnchorYOffset = objDateHere.AnchorYOffset;
                            objDSHere.AnchorUnits = objDateHere.AnchorUnits;
                            objDSHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
                            objDSHere.AnchorMatchWholeWord = "true";
                            ////objDSHere.Value = objDateHere.Value;
                            lstSalesDateHere.Add(objDSHere);
                        }
                    }

                    if (objModel.Tabs.FullNameTabs != null && objModel.Tabs.FullNameTabs.Count > 0)
                    {
                        foreach (FullNameModel objDateHere in objModel.Tabs.FullNameTabs)
                        {
                            FullName objNameHere = new FullName();
                            objNameHere.PageNumber = (!string.IsNullOrEmpty(objNameHere.PageNumber)) ? objNameHere.PageNumber : "1"; 
                            objNameHere.AnchorString = objDateHere.AnchorString;
                            objNameHere.DocumentId = objDateHere.DocumentId;
                            objNameHere.RecipientId = objDateHere.RecipientId;
                            objNameHere.AnchorXOffset = objDateHere.AnchorXOffset;
                            objNameHere.AnchorYOffset = objDateHere.AnchorYOffset;
                            objNameHere.AnchorUnits = objDateHere.AnchorUnits;
                            objNameHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
                            objNameHere.Value = objDateHere.Value;
                            objNameHere.AnchorMatchWholeWord = "true";
                            lstSalesNameHere.Add(objNameHere);
                        }
                    }
                }

                objTab.SignHereTabs = lstSalesSignHere;
                objTab.DateSignedTabs = lstSalesDateHere;
                objTab.FullNameTabs = lstSalesNameHere;
                objSigner.Tabs = objTab;
                lstSigner.Add(objSigner);
            }
        }

        return lstSigner;
    }

我不知道这是最佳做法,但我的问题已解决。如果这不是一个好的做法,请提出建议。

改库后

遗憾的是,它在文档中的签名位置不起作用。我的文档中有两个字段 SignatureSignaturedate 但当我通过 DocuSign 网站签署文档时,这些字段放置在错误的位置。请参阅下面的文档。

所以分配页码不能解决我的问题。

请更新上面的实际代码更改,因为您显示的内容与下面 "Say" 的内容似乎有冲突。

您似乎缺少 "TabId" 又名 "Tab Item"

              "name": "sample string 1",
              "tabLabel": "sample string 2",
              "scaleValue": 3.1,
              "optional": "sample string 4",
              "documentId": "sample string 5",
              "recipientId": "sample string 6",
              "pageNumber": "sample string 7",
              "xPosition": "sample string 8",
              "yPosition": "sample string 9",
              "anchorString": "sample string 10",
              "anchorXOffset": "sample string 11",
              "anchorYOffset": "sample string 12",
              "anchorUnits": "sample string 13",
              "anchorIgnoreIfNotPresent": "sample string 14",
              "tabId": "sample string 15",
              "conditionalParentLabel": "sample string 16",
              "conditionalParentValue": "sample string 17"

https://www.docusign.net/restapi/help

我真的建议使用 PostMan 客户端和/或 SoapUI 来验证您是否可以进行 api 调用,尤其是在开始时。通过这种方式,您可以看到返回的实际错误,因为它会在针对非常常见的错误的响应中详细说明错误。 PostMan 或 SoapUI 将成功发出实际的 API 调用(Demo 或 Prod 一旦你通过了 prod API 认证)向你展示实际的响应,而不必担心编码错字,objects 的属性或调试日志记录以查看真正返回的内容。

这允许您在使用您选择的 SDK 的同时学习 DocuSign API。您在 Stack Overflow 上寻求帮助是对的。

我有几个链接供您开始使用:

DocuSign 开发人员中心,您可能会在其中找到 PHP SDK https://developers.docusign.com/esign-rest-api/sdk-tools

Link 有关 PostMan 的信息(旧版本,您可以获得最新版本 - 又名 Orange Rocket Man 徽标与蓝色世界,Chrome 或 Mac 独立 - https://blog.grigsbyconsultingllc.com/postman-rest-client-a-google-chrome-app/

X-DocuSign-Authentication Header Whosebug 上的问答 header X-DocuSign-Authentication 应该如何用于 REST 和 SOAP?

我一开始就喜欢 DocuSign API 资源管理器的概念,遗憾的是它对产品不起作用,因此当您从演示转到产品时,您仍然必须使用其他东西。

正如上面 "Amit K Bist" 所提到的,您可以准确地捕获 JSON 发布您的 PHP 的请求 | API 按照此 DocuSign 支持文章 https://support.docusign.com/guides/ndse-user-guide-api-request-logging

中解释的步骤进行调用

祝你好运,享受你的 DocuSign API 之旅!