Error when using the REST Api trying to convert a document
Hi
the example for adapters in the REST Api section of the documentation does not work
/nuxeo/api/v1/id/{docId}/@blob/file:content/@op/Blob.ToPDF
the first part /nuxeo/api/v1/id/{docId}/@blob/file:content/ does provide the binary file, but adding the convert operation leads to a webengine error.
0 votes
2 answers
2119 views
Ok, the correct answer is the following, you have to :
- make a POST request (since its an automation operation)
- add the application/json+nxrequest header as Content-Type
- add some empty param in the request body like {“params”:{}}
To be sure, here is a sample request on demo.nuxeo.org with curl that works
curl -X POST -H "Content-Type: application/json+nxrequest" -u Administrator:Administrator -d '{"params":{}}' http://demo.nuxeo.com/nuxeo/api/v1/path/default-domain/workspaces/IT%20Department/Expertise%20Center/Alice\'s%20Adventures%20in%20Wo/@blob/file:content/@op/Blob.ToPDF > test.pdf