Mustafa
Mustafa

Reputation: 69

Nuxeo server upload multiple files to a document

Using below endpoint I can create document with single file in nuxeo server : http://localhost:8080/nuxeo/api/v1/path/domain/workspace. But I can not create document with multiple files. How I can do it?

Upvotes: 1

Views: 460

Answers (1)

Dipesh KC
Dipesh KC

Reputation: 2463

http://localhost:8080/nuxeo/api/v1/upload/

gives you <myBatchId>

Posting first image on that batch

http://localhost:8080/nuxeo/api/v1/upload/<myBatchId>/0

Posting second image on that batch

http://localhost:8080/nuxeo/api/v1/upload/<myBatchId>/1

Posting third image on that batch

http://localhost:8080/nuxeo/api/v1/upload/<myBatchId>/2

Finally

http://localhost:8080/nuxeo/api/v1/path/domain/workspace

{
  "entity-type": "document",
  "name":"myNewDoc",
  "type": "File",
  "properties" : {
    "dc:title":"My new doc",
    "file:content": {
      "upload-batch":"<myBatchId>",
      "upload-fileId":"0"
    },
    "files:files":[
        { "file" :  {
           "upload-batch":"<myBatchId>",
           "upload-fileId":"1"
        }},
        { "file" :  {
           "upload-batch":"<myBatchId>",
           "upload-fileId":"2"
        }},
     ]
   }
}

Upvotes: 1

Related Questions