cancel
Showing results for 
Search instead for 
Did you mean: 

Error when using the REST Api trying to convert a document

pibou_Bouvret
Elite Collaborator
Elite Collaborator

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.

1 ACCEPTED ANSWER

Damien_Metzler
Star Contributor
Star Contributor

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

View answer in original post

4 REPLIES 4

Damien_Metzler
Star Contributor
Star Contributor

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

Nope,

Damien_Metzler
Star Contributor
Star Contributor

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

the request body made it