Ryan_Coleman

Send multiple documents via one transaction ID

0 votes
Is it possible to send multiple documents via one API call and one transaction? This is similar to the code in the example, can I just append each file to a new form for the MultipartFormDataContent? ByteArrayContent content = new ByteArrayContent(fileByteArray); content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data"); content.Headers.ContentDisposition.Name = "\"file\""; content.Headers.ContentDisposition.FileName = "\"" + MiscFunctions.RemoveSpecialCharacters(pdfDoc.Name) + ".pdf" + "\""; content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf"); MultipartFormDataContent form = new MultipartFormDataContent(); form.Add(content, $"\"file\"", "\"" + MiscFunctions.RemoveSpecialCharacters(pdfDoc.Name) + ".pdf" + "\""); form.Add(jsonContent, "\"payload\"");

Reply to: Send multiple documents via one transaction ID

0 votes
Hi Ryan, To explain the actual format of http request more clearly, the first attachment is a snippet excerpted from Fiddler. From the screenshot, you can see each Content-Disposition is actually separately by "--"+boundary. If you need to upload multiple documents, the name of the Content-Disposition shares the same as "file". And at the end, you need to use "--"+boundary+"--" to end the request. And the second attachment is an example for creating a package with multiple documents, but it's using WebClient object to send the same REST package. Hope this could help you! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Attachments
8-7-1.png26.99 KB

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