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

1300 views

ANSWER



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
1 votes



the request body made it

{"params":{}}

thanks

03/28/2014


Did you add the application/json+nxrequest header in your request ?

0 votes



Nope,

but adding the header did not change the result (Error 500)

03/28/2014