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.
Changing document_type from api [SOLVED]
Re: Changing document_type from api
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
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
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
Thanks for the feedback, we'll add an API entrypoint to change the document type of a document.
-
- Posts: 4
- Joined: Wed Sep 11, 2019 6:56 pm
Re: Changing document_type from api
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.
-
- Posts: 4
- Joined: Wed Sep 11, 2019 6:56 pm
Re: Changing document_type from api
Awesome. You are a gentleman and a scholar!
Re: Changing document_type from api
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.