11-19-2015 04:32 AM
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...
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" }
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.
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
11-19-2015 08:55 AM
According to [the page you gave](https
11-19-2015 11:27 AM
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
11-20-2015 08:50 AM
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.
11-20-2015 10:17 AM
The answer was also here
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.