This topic contains 2 replies, has 1 voice, and was last updated by  Haris 9 months, 1 week ago.

  • Author
    Posts
  • Participant
    mvonahn
    Newbie
    Member since: 02.12.2015
    Number of posts: 6

    We are trying to add multiple documents with Meta Data to the REST API in a single call.

    We are able to add a single document with meta data using a call like

    POST /api/packages/CexKAcIADCrhmET2TheZdEtnnQA=/documents/ HTTP/1.1
    Host: sandbox.esignlive.com
    Authorization: Basic XXXXXXXXXXXXXXXXXXXXX
    Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
    Cache-Control: no-cache
    
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="payload"
    
     {
        "description": "A test document 1.",
        "name": "45-Sold Notice.pdf"
      }
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="file"; filename="3-Sold Notice.pdf"
    Content-Type: application/pdf
    

    We are able to add multiple files using a call like

    POST /api/packages/CexKAcIADCrhmET2TheZdEtnnQA=/documents/ HTTP/1.1
    Host: sandbox.esignlive.com
    Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXX
    Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
    
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="files[]"; filename="3-Sold Notice.pdf"
    Content-Type: application/pdf
    
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="files[]"; filename="9-Bill Of Sale.pdf"
    Content-Type: application/pdf
    
    ------WebKitFormBoundary7MA4YWxkTrZu0gW
    Content-Disposition: form-data; name="files[]"; filename="24-Power of Attorney.pdf"
    Content-Type: application/pdf
    
    ------WebKitFormBoundary7MA4YWxkTrZu0gW--
    

    What we cannot seem to do is add multiple documents to a package in one call.

    changing the payload to be an array results in an error
    payload

     {"documents" : [{
        "description": "A test document 1.",
        "name": "45-Sold Notice.pdf"
      }, {
        "description": "A test document 1.",
        "name": "46-Sold Notice.pdf"
      }, {
        "description": "A test document 1.",
        "name": "47-Sold Notice.pdf"
      }
    ]}

    response

    {
        "messageKey": "error.validation.addDocument.documentNameEmpty",
        "message": "Document name cannot be empty.",
        "code": 400,
        "name": "Validation Error"
    }
    

    we have tried multiple other ways, none with any success.

    Keymaster
    Haris
    Jedi Master
    Member since: 05.11.2015
    Number of posts: 1450

    Score

    0

    Hi there,

    I wasn’t able to get it working either when including a JSON payload. I will follow up with our maintenance team and get back to you.


    Haris Haidary
    OneSpan Technical Consultant
    Keymaster
    Haris
    Jedi Master
    Member since: 05.11.2015
    Number of posts: 1450

    Score

    0

    Unfortunately, it seems that it’s not possible to pass the JSON payload when uploading multiple documents. We’ve created an enhancement request for the application. Right now, your best option appears to be to upload the documents individually. I will post back here for any updates.


    Haris Haidary
    OneSpan Technical Consultant

You must be logged in to reply to this topic.