mvonahn

Adding Multiple Documents with Meta Data

0 votes
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.

Reply to: Adding Multiple Documents with Meta Data

0 votes
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

Reply to: Adding Multiple Documents with Meta Data

0 votes
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

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off