Attach file to Document through REST API

Hi,

Is it possible to attach a file to a document by sending a POST request to http://localhost:8080/nuxeo/restAPI/default/07e47804-db53-4598-8a0a-427749c6e762/file/upload, where '07e47804-db53-4598-8a0a-427749c6e762' is the docid and 'file' is what I'd like the file stored as.

When I try to send this request, I get the following error in my log:

2013-05-27 15:45:28,918 ERROR [org.nuxeo.ecm.webapp.security.UserSessionBean] Can not fetch user principal from FacesContext: there is no FacesContext attached to the current request 2013-05-27 15:45:28,919 ERROR [org.nuxeo.ecm.webapp.security.UserSessionBean] Can not fetch user principal from FacesContext: there is no FacesContext attached to the current request 2013-05-27 15:45:28,919 ERROR [org.nuxeo.ecm.webapp.filemanager.FileManageActionsBean] Error importing DMS_Review.txt org.nuxeo.ecm.core.api.ClientException: Cannot create document of type Note in container with type SectionRoot .

I'm guessing this is because there is no user authentication. How could I do this properly?

Thanks.

0 votes

1 answers

1942 views

ANSWER



I suggest you to use the automation REST as this one is deprecated:

http://doc.nuxeo.com/display/NXDOC/Using+Nuxeo+Automation+Client?desktop=true

0 votes