【问题标题】:Bad Request While Trying to create transient document in adobe using REST API尝试使用 REST API 在 adobe 中创建临时文档时出现错误请求
【发布时间】:2020-02-21 16:09:41
【问题描述】:

我正在尝试使用 rest api 在 adobe sign 中创建一个临时文档。以下是我的代码 sn-p:

        Http h = new Http(); 
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://api.in1.echosign.com/api/rest/v6/transientDocuments');
        req.setMethod(postMethod); 
        req.setHeader('Content-Type', 'application/json');
        blob testFileContent = blob.toPDF('test string it is'); 
       // req.setBody('{"filename":"testsign","file":'+testFileContent+'}');
        req.setBody('{"fileName":"testsign","file":"'+testFileContent+'"}');
        String authorizationHeader = 'Bearer ' +acceessToken;
        req.setHeader('Authorization', authorizationHeader); 
        //req.setHeader('Authorization', acceessToken);
        try{
            HttpResponse res = h.send(req);

但是我在响应中收到错误的请求错误。问题可能是由于标签与 adobe 签名要求不匹配,但是经过大量研究和反复试验后,我无法找到要放入 JSON 的准确标签此 API 请求。有什么建议和帮助吗?

【问题讨论】:

  • 我刚刚发现请求必须是由文件名、MIME 类型和文件流组成的分段文件上传请求。它必须采用以下格式。我正在尝试生成相同但仍然收到错误请求的错误。实现这一目标的方法应该是什么? POST /api/rest/v6/transientDocuments HTTP/1.1 Host: api.na1.echosign.com Authorization: Bearer MvyABjNotARealTokenHkYyi Content-Type: multipart/form-data Content-Disposition: form-data; name=";File"; filename="MyPDF.pdf" <PDF CONTENT>

标签: rest api adobe bad-request echosign


【解决方案1】:

表单数据

Content-Disposition: form-data; name="File"; filename="<filename>.pdf"
Content-Type: application/pdf

请求参数

Content-Type: multipart/form-data;
Accept: application/json, text/javascript, */*;

更多详情请见documentation

【讨论】:

    猜你喜欢
    • 2021-12-23
    • 2017-05-31
    • 2023-02-13
    • 2020-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-03
    相关资源
    最近更新 更多