java - 使用 docusign api 创建信封,错误 : Object moved

标签 java docusignapi

我查阅了API文档,在api explorer->Envelopes: create中发送成功。我还得到了 json 和请求路径和 token 。我在java中使用了httpclient post并收到了对象移动对象移动到这里。有谁知道我错过了什么? `

    DocsignDocument docsignDocument = new DocsignDocument();
    docsignDocument.setDocumentBase64
    docsignDocument.setDocumentId("1");
    docsignDocument.setFileExtension("pdf");
    docsignDocument.setName("Test.pdf");
    list.add(docsignDocument);
    Recipients recipients = new Recipients();
    Signers signers = new Signers();
    signers.setEmail("xxxx");
    signers.setName("Qin");
    signers.setRecipientId("1");
    Signers signers1 = new Signers();
    signers1.setEmail("xxx@qq.com");
    signers1.setName("OYX");
    signers1.setRecipientId("2");
    List<Signers> signersList = new ArrayList<>();
    signersList.add(signers);
    signersList.add(signers1);
    recipients.setSigners(signersList);
    dataJson.put("documents",list);
    dataJson.put("emailSubject","TEST");
    dataJson.put("recipients",recipients);
    dataJson.put("status","sent");
    String data = dataJson.toJSONString();
    String results2 = HttpDocusignUtils.httpPostJson("https://account-d.docusign.com/restapi/v2.1/accounts/xxx/envelopes",access_token,data)`

发帖请求:

 public static String httpPostJson(String uri, String token, String obj) {
    String result = "";
    try {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        HttpPost httpPost = new HttpPost(uri);
        httpPost.addHeader("Content-Type", "application/json"); // 添加请求头
        httpPost.addHeader("Authorization","Bearer "+token);
       httpPost.addHeader("Accept-Encoding","gzip,deflate,sdch");
       httpPost.setEntity(new StringEntity(obj));
        System.out.println(httpPost);
        HttpResponse response = httpclient.execute(httpPost);
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            InputStream instreams = entity.getContent();
            result = convertStreamToString(instreams);
            System.out.println(result);
        }
    } catch (Exception e) {
        e.getMessage();
    }
    return result;
}

最佳答案

https://account-d.docusign.com/restapi/v2.1/accounts/xxx/envelopes 不是有效的 DocuSign 端点。

帐户服务器 (account-d.docusign.com) 用于获取 token 并创建 UserInfo调用以确定特定帐户的正确基本 URL。

由于您处于演示环境,因此您的基本网址将以 https://demo.docusign.net 开头

关于java - 使用 docusign api 创建信封,错误 : Object moved,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60737510/

相关文章:

java - 在一个类中使用 String/int/long 等

java - 在Java中解析JSON url

java - 在字符串中出现的每个数字之前插入换行符?

elixir - 未创建 Docusign DateSigned 选项卡

node.js - Node.js 和 Handlebars 中的 DocuSign API 集成

node.js - 如何使用 Docusign 的 REST API 预填充从模板创建的信封中的字段?

java - token "22f"出现语法错误,删除此 token

java - 如何使用 Jena 处理 DBpedia 页面的 rdf 版本?

apache - 使用 Docusign API curl SSL 相关连接超时

java - 在 docusign Rest api 中,在创建信封时,它总是发送到除 json 包含邮件之外的其他邮件?