cancel
Showing results for 
Search instead for 
Did you mean: 

How i can upload multile images in nuxeo 7.4

Ramakrishna_Gad
Confirmed Champ
Confirmed Champ

Hi All,

I am facing Issues in uploading multiple images in nuxeo using REST API. i am following below URL for the Batch upload https://doc.nuxeo.com/display/NXDOC/How+to+Upload+a+File+in+Nuxeo+Platform+Using+REST+API+Batch+Proc...

  1. First I am creating a Batch using below API POST : http://localhost:8080/nuxeo/api/v1/upload i am getting below Response

    { "batchId": "batchId-293bdcf0-5366-4f5c-ac0f-a18ad7f5eb77" }

  2. I am adding images to batch using below API POST http://localhost:8080/nuxeo/api/v1/upload/batchId-293bdcf0-5366-4f5c-ac0f-a18ad7f5eb77/0 In the body I am attaching image.

    POST http://localhost:8080/nuxeo/api/v1/upload/batchId-293bdcf0-5366-4f5c-ac0f-a18ad7f5eb77/1 POST http://localhost:8080/nuxeo/api/v1/upload/batchId-293bdcf0-5366-4f5c-ac0f-a18ad7f5eb77/2 POST http://localhost:8080/nuxeo/api/v1/upload/batchId-293bdcf0-5366-4f5c-ac0f-a18ad7f5eb77/3 I have attached 4 images to the batch.

  3. Here i am fetching batch content using below API. GET http://localhost:8080/nuxeo/api/v1/upload/batchId-293bdcf0-5366-4f5c-ac0f-a18ad7f5eb77 I am getting response as below [ { "size": 8670, "name": "shirt10.jpg", "uploadType": "normal" }, { "size": 9351, "name": "shirt9.jpg", "uploadType": "normal" }, { "size": 12178, "name": "shirt8.jpg", "uploadType": "normal" }, { "size": 8170, "name": "shirt7.jpg", "uploadType": "normal" } ] Now how to upload this bath to http://localhost:8080/nuxeo/api/v1/path/default-domain/workspaces/test-workspace please let me know what headers and body should contain. I am not able to upload these batch images to my test-work space Please help me to solve this issue

Thanks

4 REPLIES 4

Greg_Drayon
Star Contributor
Star Contributor

According to [the page you gave](https

Ramakrishna_Gad
Confirmed Champ
Confirmed Champ

I want to upload other files also using files property. Please let me know how to do it in the single request . by batch content is

Greg_Drayon
Star Contributor
Star Contributor

OK, after some tests and with the help of this question, here is how to do it.

curl -X POST -H 'Content-Type: application/json' -u Administrator:Administrator -d '{"entity-type": "document", "name": "myNewDoc", "type": "File", "properties": {"dc:title": "My great new doc", "file:content": {"upload-batch": "batchId-9256ed17-312a-4bbe-ae00-b8b99994200b", "upload-fileId": "0"}, "files:files": [ {"file": {"upload-batch": "batchId-9256ed17-312a-4bbe-ae00-b8b99994200b", "upload-fileId": "1"}, "filename": "test2.JPG"}, {"file":{"upload-batch": "batchId-9256ed17-312a-4bbe-ae00-b8b99994200b", "upload-fileId": "2"}, "filename": "test3.JPG"} ]}}' http://localhost:8080/nuxeo/api/v1/path/default-domain/workspaces/workspace

This is the curl version, I let you translate to the other version and adapt it to your need. There is a "file" schema part and a "files" schema one.

Also, from the page of the other question, providing a name, mime-type and length in the "file" part seems useless, as they are taken from the uploaded file. But I added the "filename", because without it, the files tab would display the files without name, so without link to actually download them, enabling you to only download them from the summary tab.

The answer was also here