Hi there.
I'm trying to use the REST API to update de document metadata. With this body I'm successfully changing the document title and some of my extra attribute, but I'm unable to change the folder of the document. I checked that the folderId already exists. Am I forgetting anything?
{"id":3870395,"folderId":3835158,"title":"20170807104422_nx0rv5f4t6_old","attributes":[{"name":"Type","stringValue":"Category 2"}]}
Thanks.
Cannot move document using REST API
Moderator: car031
- admin
- Site Admin
Post
Re: Cannot move document using REST API
Hi you should pay attention to the HTTP method used,
in order to update a document you must use the PUT method.
So in order to change the folder of a document that should be enough
Note that in order to move a document from source folder A to target folder B,
you should have write permission on folder B and delete permission on folder A
in order to update a document you must use the PUT method.
So in order to change the folder of a document that should be enough
Code: Select all
'{ "id":106758151, "folderId":4 }'
you should have write permission on folder B and delete permission on folder A
Post
The PUT method is ok and the title and attributes are changing ok. The API user is in the 'admins' group, so I think it's not a permissions problem isn't it?
Re: Cannot move document using REST API
Hi admin.admin wrote: ↑Mon Aug 07, 2017 11:31 amHi you should pay attention to the HTTP method used,
in order to update a document you must use the PUT method.
So in order to change the folder of a document that should be enough
Note that in order to move a document from source folder A to target folder B,Code: Select all
'{ "id":106758151, "folderId":4 }'
you should have write permission on folder B and delete permission on folder A
The PUT method is ok and the title and attributes are changing ok. The API user is in the 'admins' group, so I think it's not a permissions problem isn't it?
Post
Re: Cannot move document using REST API
Hi phurtado,
you should carefully check the id of the target folder "folderId"
and perhaps the main log of web-application: /repository/dms.log
you should carefully check the id of the target folder "folderId"
and perhaps the main log of web-application: /repository/dms.log
Post
I'm sure the target folderId is correct. I checked the dms.log but nothing remarkable. Tried adding permissions manually to the admin group on both folders, but nothing changed.
Any other idea? I'm totally lost.
Thanks for your help.
Re: Cannot move document using REST API
Hi agaspa.
I'm sure the target folderId is correct. I checked the dms.log but nothing remarkable. Tried adding permissions manually to the admin group on both folders, but nothing changed.
Any other idea? I'm totally lost.
Thanks for your help.
Post
Re: Cannot move document using REST API
Hi phurtado,
in the past it was possible to use the update method also to move a document from one folder to another, but now no longer.
The update method simply modifies the metadata of the document, but does not move it.
The move method has been introduced for this scope, but in the 7.6.4 version is not yet available in the REST API.
in the past it was possible to use the update method also to move a document from one folder to another, but now no longer.
The update method simply modifies the metadata of the document, but does not move it.
The move method has been introduced for this scope, but in the 7.6.4 version is not yet available in the REST API.
Post
Re: Cannot move document using REST API
Try the attached patch (LD 7.6.4)
it adds the method move (HTTP PUT) with 2 query params: docId and folderId
You should uncompress in /classes
on Windows
C:\LogicalDOC\tomcat\webapps\ROOT\WEB-INF\classes
it adds the method move (HTTP PUT) with 2 query params: docId and folderId
You should uncompress in /classes
on Windows
C:\LogicalDOC\tomcat\webapps\ROOT\WEB-INF\classes
- Attachments
-
- LD-764-patch-REST-move.zip
- (7.49 KiB) Downloaded 298 times
Post
I found a bit strange not using json or xml in the put method but this patch worked for me
Thank you!
Re: Cannot move document using REST API
Hi agaspa.
I found a bit strange not using json or xml in the put method but this patch worked for me
Thank you!
Who is online
Users browsing this forum: No registered users and 93 guests