Publié Thu, 23 Jun 2022 17:06:09 GMT par Aren Slootweg Developer
I need to make a json api which can handle large file uploads. I use PHP as programming lanuage and have created several API's with it.
In the new API we need there is a chunk mechanisme supported to chop the files in smaller parts.

I need to use the REST API for this. Uploading documents is no problem but how to support the upload when we have to chunk the document in smaller parts. Is there a way to do this and is there a example (PHP)  available?

I have seen .NET examples but they are not helpful if you need a REST API sample.


Publié Thu, 21 Jul 2022 15:07:57 GMT par Aren Slootweg Developer
Nobody?  Docuware Support?
Publié Fri, 22 Jul 2022 09:04:14 GMT par Leopold Pohlmann DocuWare Europe GmbH Technician Software Support Team GREEN EMEA
I've tested how the chunk upload of the .NET API is performed. The requests have to be as follows:

[POST] /DocuWare/Platform/FileCabinets/{{fcId}}/Documents

Content-Type: {{FILETYPE}}
Content-Disposition: inline; filename={{FILENAME}}; modification-date="{{MODDATE}}"
X-File-Name: {{FILENAME}}
X-File-Size: {{FILESIZE}}
X-File-ModifiedDate: 07/22/2022 08:40:44
Cookie: {{COOKIES}}
Content-Length: {{CHUNKSIZE}}
Expect: 100-continue
Accept-Encoding: gzip

In the body add the chunk content

For each additional chunk use the following URI:

[POST] /DocuWare/Platform/FileCabinets/{{fcId}}/Documents?loc={{CHUNKSIZE * CHUNKNUMBER}}&chunkReference={{CHUNKREFERENCEGUID}}

- The loc parameter consists of the chosen chunk size (e.g. 300000 and the index of the chunk starting at 0). The first chunk has no loc, the second chunk has 300000 * 1 = 300000 the second has 300000 * 2 = 600000 and so on...
- The chunkReference parameter has to contain the guid from the response from the last response (Document -> FileChunk -> LastChunkId)

The header and the body are built the same way as in the first request. I attach a screenshot which show a chunk upload in Fiddler.

Please mind, that the upload might fail for large files because of time outs that might occur.

Best Regards,
Publié Fri, 22 Jul 2022 09:39:22 GMT par Aren Slootweg Developer
Thank you very much Leopold.

You must be signed in to post in this forum.