Page 1 of 1

Changing document_type from api [SOLVED]

Posted: Mon Sep 02, 2019 5:14 pm
by jere
I am trying to change the document type of a document via the API. I *think* I should use the PATCH version of /api/documents/{id}/ but no matter what I put in for document_type, and I've tried several variations, it doesn't work. I see that the front end uses /documents/{id}/type/ but that requires a csrf token that I don't have when using the rest api.

Any pointers in the right direction would be helpful.

Re: Changing document_type from api

Posted: Tue Sep 03, 2019 9:00 am
by elmcrest
Hey jere,

I'd say it's not possible to change the document_type via an api request. the embedded type for the documents request tells that the document_type id is readOnly ...
besides I would also expect for this kind of operation a dedicated api endpoint so something like /documents/{id}/change_document_type_to/{document_type_id} - just to give you an Idea.

I'm new to MayanEDMS so I might be wrong...

Hope it helped,

cheers

Re: Changing document_type from api

Posted: Thu Sep 05, 2019 10:33 pm
by jere
My current work around is to connect to the database directly and manipulate it there. I'm sure this is bad and I hope to be able to use the API in the future. I'm not sure *how* it is bad other than any indexes relying on the doc type have to be rebuilt afterwards.

Re: Changing document_type from api

Posted: Fri Sep 06, 2019 9:40 pm
by rosarior
Thanks for the feedback, we'll add an API entrypoint to change the document type of a document.

Re: Changing document_type from api

Posted: Fri Sep 27, 2019 7:27 pm
by mcrotsenburg
rosarior wrote: Fri Sep 06, 2019 9:40 pm Thanks for the feedback, we'll add an API entrypoint to change the document type of a document.
Is there a timeline for this feature request? I just discovered that I require the same functionality. Thanks!

Re: Changing document_type from api

Posted: Tue Oct 01, 2019 3:50 am
by rosarior
We are going to try to squeeze this for the version 3.3 release. This release is scheduled for October after bugfix version 3.2.8 is out.

Re: Changing document_type from api

Posted: Wed Oct 09, 2019 8:54 pm
by mcrotsenburg
Awesome. You are a gentleman and a scholar!

Re: Changing document_type from api

Posted: Thu Nov 28, 2019 5:58 am
by rosarior
Document type change API is now in the version 3.3 code: https://gitlab.com/mayan-edms/mayan-edm ... 85e46c8cb1. This version is almost ready.