To upload file(s) using REST API, we have to use the "batch API, which is described in the doc and in 2 blogs (there and there) and is summarized here:
- First, send the file, giving it a batch id and using the /api/v1/automation/batch/upload API:
- Then, create a new document (POST) and set its file:content to the batch-id and file index
This works like a charm in 5.9.3 and does not work anymore in 5.9.4. The nuxeo document is created (a File, a Picture, ...), but the file is not bound to the document, the server reports an Unable to find batch with id plane-1.JPG error (in my example, the batch-id is the name of the file, "plane-1.JPG"). See attached log.
Excerpt:
2014-06-09 16:57:48,190 ERROR [http-bio-0.0.0.0-8080-exec-4] [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] Exception in JAX-RS processing java.lang.NullPointerException at org.nuxeo.ecm.webengine.model.impl.AbstractResource.newObject(AbstractResource.java:234) at org.nuxeo.ecm.automation.server.jaxrs.AutomationResource.getBatchManager(AutomationResource.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606)
- depends on
-
NXP-14482 Migrate nuxeo-rest-api into features
- Resolved