簡體   English   中英

使用PUT方法的REST更新收件人電子郵件

[英]REST Update Recipient Email using PUT Method

我是REST新手,並通過以下代碼不斷收到Bad Request 400 Response:

我有其他示例中的標准baseURL和authenticateStr ...

_recipientID,pNewEmail,pNewName和pNewRoutingOrder作為參數傳遞給過程。

            string envDef = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
                                "<signers>" +
                                    "<signer>" +
                                            "<recipientId>" + _recipientId + "</recipientId>" +
                                            "<email>" + pNewEmail + "</email>" +
                                            "<name>" + pNewName + "</name>" +
                                            "<routingOrder>" + pNewRoutingOrder + "</routingOrder>" +
                                    "</signer>" +
                                "</signers>" +
                            "</envelopeDefinition>"; 

        url = baseURL + "/envelopes/" + pEnvelopeID + "/recipients";
        request = (HttpWebRequest)WebRequest.Create(url);
        request.Headers.Add("X-DocuSign-Authentication", authenticateStr);
        request.ContentType = "application/xml";
        request.Accept = "application/xml";
        request.ContentLength = envDef.Length;
        request.Method = "PUT";
        // write the body of the request
        byte[] body = System.Text.Encoding.UTF8.GetBytes(envDef);
        Stream dataStream = request.GetRequestStream();
        dataStream.Write(body, 0, envDef.Length);
        dataStream.Close();
        // read the response
        webResponse = (HttpWebResponse)request.GetResponse();
        sr.Close();

        responseText = "";
        sr = new StreamReader(webResponse.GetResponseStream());
        responseText = sr.ReadToEnd(); 

好吧,剛想出如何做到這一點。 例如,這是一個XML請求正文,可用於更新電子郵件和收件人姓名。 我剛剛驗證了此功能!

<recipients xmlns="http://www.docusign.com/restapi">
   <signers>
      <signer>
         <recipientId>1</recipientId>
         <email>email@docusign.com</email>
         <name>Joe Mama</name>
      </signer>
   </signers>
</recipients>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM