且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

非常基本的内容-如何通过REST API将文档发送到docusign?我只看到<文档字节在这里...>到处

更新时间:2022-05-09 07:52:41

您尚未发布相关的代码,因此调试起来更加困难,但从表面上看,您发布的文字至少有两个问题。一种是文档字节不应该用括号 { } 括起来。

You haven't posted the relevant code which makes it harder to debug, but on the surface there are at least two problems with the text you've posted. One is that the document bytes should not be enclosed with brackets { }.

接下来,您似乎无法正确地编码文档字节。 PDF原始字节将不会以 [B @ 1 ......开头。如果看不到您的代码,我只能说您需要检查一下您的状态。将PDF字节写入请求。

Next it does not look like you are encoding the document bytes correctly. The PDF raw bytes will not start with [B@1.......... Without seeing your code I can only say you need to review how you are writing the PDF bytes to the request.

如此之多的帖子显示 Document Bytes Go Here的原因是,在示例请求中包含一堆随机的,非人类可读的字符是非常无用的。如果您是程序员,并且了解将文档字节写入流的含义,那么您应该不会有任何问题。这是一个示例请求,再次省略了文件字节:

The reason why so many posts show "Document Bytes Go Here" is that it's pretty useless having a bunch of random, non-human readable characters in the sample request. If you are programmer and you understand what it means to write document bytes to a stream then you should understand no problem. Here is a sample request with once again the document bytes omitted:

POST https://demo.docusign.net/restapi/v2/accounts/123456/envelopes HTTP/1.1

X-DocuSign-Authentication: {"Username":"USERNAME","Password":"PASSWORD","IntegratorKey":"INTEGRATOR_KEY"}
Content-Type: multipart/form-data; boundary=BOUNDARY
Accept: application/json
Host: demo.docusign.net
Content-Length: 23414
Expect: 100-continue
Connection: Keep-Alive

--BOUNDARY
Content-Type: application/json
Content-Disposition: form-data

{
    "status": "sent",
    "emailBlurb": "Test Email Body",
    "emailSubject": "Test Email Subject",
    "documents": [
        {
            "name": "test.pdf",
            "documentId": "1",
            "order": "1"
        }
    ],
    "recipients": {
        "signers": [
            {
                "email": "test@domain.com ",
                "name": "John Doe",
                "recipientId": "1",
                "tabs": {
                    "signHereTabs": [
                        {
                            "xPosition": "100",
                            "yPosition": "100",
                            "documentId": "1",
                            "pageNumber": "1"
                        }
                    ]
                }
            }
        ]
    }
}

--BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="document.pdf"; documentid="1"

[document bytes removed]

--BOUNDARY--

上述请求将发送一个签名请求,该签名请求的签名者为一个收件人,并将一个签名选项卡放置在文档中的位置 100 右边的像素,而文档左上角的 100 像素。查看 DocuSign API演练,以获取有关如何完成此操作的代码示例,尤其是第四次演练在文档上请求签名会以6种不同的语言( PHP JavaScript Java C# Python Objective-C ),并附有说明:

The above request will send a signature request with one recipient of type signer and will place one signature tab on the document for them at location 100 pixels to the right and 100 pixels down from the top left of the document. Check out the DocuSign API Walkthroughs for code samples on how to accomplish this, in particular the 4th walkthrough Request Signature on a Document shows you exactly how to do this in 6 different languages (PHP, Javascript, Java, C#, Python, Objective-C) with instructions:

http://iodocs.docusign.com/APIWalkthroughs