cancel
Showing results for 
Search instead for 
Did you mean: 

Attach file to Document through REST API

sk90_
Champ in-the-making
Champ in-the-making

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.

1 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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

View answer in original post

1 REPLY 1

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

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