-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 9.10, 10.1
-
Component/s: Rest API
- install 9.10
- setup multi-repository environment
Following this documentation:
https://doc.nuxeo.com/nxdoc/document-resources-endpoints/#updating-a-document
One can update a document through REST.
Using this url:
http://localhost:8080/nuxeo/api/v1/repo/[repositoryId]/id/[documentId]
With the following payload:
{"entity-type":"document","uid" : "{documentId}", "properties":{"prefix:propertyName":["value"]}}
Fails to update the document with a 404 error.
It seems the issue is the session is opened in the default repository in this case:
https://github.com/nuxeo/nuxeo/blob/9.10/nuxeo-core/nuxeo-core-io/src/main/java/org/nuxeo/ecm/core/io/marshallers/json/document/DocumentModelJsonReader.java#L132
Please note that removing the uid from the payload works fine.
------------------------------------------------------------------------------------------
In this case, the repositoryId passed in the URL is now also set as a request attribute when set in the WebContext by APIRoot#doGetRepository.
It can then be retrieved by SessionFactory#getRepositoryName and RenderingContextImpl#getSession.