2015-05-29 67 views
1

我正在嘗試創建信封並獲取收件人URL以供進一步處理。 但總是得到休息錯誤「ACCOUNT_NOT_AUTHORIZED_FOR_ENVELOPE」。Docusign .NET Sdk創建文檔並獲取收件人視圖(嵌入簽名)(ACCOUNT_NOT_AUTHORIZED_FOR_ENVELOPE)

 string RecipientEmail = "[email protected]"; 
     string RecipientName = "123"; 
     string AccountEmail = "[email protected]"; 
     string AccountPassword = "mypassword"; 
     string documentPath = @"C:\Users\...."; ; 

     var account = new Account(); 
     account.Email = AccountEmail; 
     account.Password = AccountPassword; 
     var result = account.Login(); 
     if (!result) 
     return; 

     var envelope = new Envelope(); 
     envelope.Login = account; 
     envelope.Recipients = new Recipients() 
     { 
      signers = new [] 
      { 
       new Signer() 
       { 
        email = RecipientEmail, 
        name = RecipientName, 
        recipientId = "1", 
        clientUserId = "777" 
       } 
      } 
     }; 
     rsult = envelope.Create(documentPath); 
     if(!result)return; 
     result = envelope.GetRecipientView("mydomain"); 

REST API

這裏是代碼例如:
github.com/kosmur/DocuSignTestWithProblems

+0

你有測試此您開發人員沙盒帳戶,還是通過主網站的免費試用帳戶? API請求只能用於您的開發人員沙箱,直到您驗證您的應用程序,然後您的集成商密鑰才能與任何帳戶一起使用。有關認證的更多信息,請參閱開發人員中心的上線部分。 – Ergin

+0

是的,我正在使用免費試用帳戶,並且一切正常,直到我打電話GetRecipientView。我正在申請demo.docusign。 –

+0

對,這就是你的問題。您無法在API中使用您的免費試用帳戶。您需要使用您通過開發人員中心創建的開發人員沙箱 – Ergin

回答

0

假設用戶通過任一定製 「X-的DocuSign-驗證」 頁眉或授權與報頭帶有每個docusign調用的持票人docusign標記。

+0

你的意思是我應該調用account.Login();方法,在每個API調用之前? –

+0

不,我的意思是在docusign api調用的請求標題中,您需要按照docusign的文檔傳遞標題。 –

+0

當然,我通過了,除getRecipientView之外,所有的程序都很好用。 –

1

您不能在API中使用免費試用賬戶(通過www.docusign.com創建)。您需要使用過的DocuSign開發中心

https://www.docusign.com/devcenter

另外創建了免費的開發沙盒,我不相信你正在跟蹤嵌入式簽名流的正確模式。您需要先創建信封(即DocuSign服務器端),然後才能請求籤名URL。我在您的GitHub代碼中看到您正在實例化一個信封對象,但我沒有看到實際創建一個的呼叫。

如果您在DocuSign .NET Client的根級別看Examples.cs向下滾動到例#8你會看到它是如何已經引用現有的信封,即

//========================================================================================== 
    // *** Walkthrough #8 - Embedded Signing 
    //========================================================================================== 
    private void EmbeddedSigning() 
    { 
     //***************************************************************** 
     // ENTER VALUES FOR FOLLOWING VARIABLES! 
     //***************************************************************** 
     string AccountEmail = "***"; 
     string AccountPassword = "***"; 
     string EnvelopeId = "***"; 
     string RecipientEmail = "***"; 
     string RecipientName = "***"; 
     //***************************************************************** 

     // user credentials 
     Account account = new Account(); 
     account.Email = AccountEmail; 
     account.Password = AccountPassword; 

     // make the login call (retrieves your baseUrl and accountId) 
     bool result = account.Login(); 
     if (!result) 
     { 
      Console.WriteLine("Login API call failed for user {0}.\nError Code: {1}\nMessage: {2}", account.Email, account.RestError.errorCode, account.RestError.message); 
      return; 
     } 

     // create envelope object and assign login info 
     Envelope envelope = new Envelope(); 
     envelope.Login = account; 

     // assign the envelope id that was passed in 
     envelope.EnvelopeId = EnvelopeId; 

     // add one signer (single recipient embedded signing currently supported in DocuSign .NET Client) 
     envelope.Recipients = new Recipients() 
     { 
      signers = new Signer[] 
      { 
       new Signer() 
       { 
        email = RecipientEmail, 
        name = RecipientName, 
        recipientId = "1" 
       } 
      } 
     }; 

     // generate the recipient view token 
     result = envelope.GetRecipientView("http://www.nuget.org/packages/DocuSign.Integration.Client.dll/"); 

     if (!result) 
     { 
      if (envelope.RestError != null) 
      { 
       Console.WriteLine("Error code: {0}\nMessage: {1}", envelope.RestError.errorCode, envelope.RestError.message); 
       return; 
      } 
      else 
      { 
       Console.WriteLine("Error encountered retrieving signing token, please review your envelope and recipient data."); 
       return; 
      } 
     } 
     else 
     { 
      // open the recipient view (SenderViewUrl field is re-used for the recipient URL) 
      Process.Start(envelope.SenderViewUrl); 
     } 
    } 
+0

嗨埃爾金,我註冊了新帳戶,但得到相同的REstError :( –

+0

謝謝你的回答埃爾金,我已經使用這個例子的代碼,並得到相同的休息錯誤,也在我的代碼在54行Git你可以看到我打電話給Create方法 –

相關問題