Changing document_type from api

Anything concerning integration via the REST API
Post Reply
jere
Posts: 8
Joined: Thu Jun 13, 2019 2:02 pm

Changing document_type from api

Post by jere » Mon Sep 02, 2019 5:14 pm

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.

elmcrest
Posts: 4
Joined: Tue Sep 03, 2019 8:05 am

Re: Changing document_type from api

Post by elmcrest » Tue Sep 03, 2019 9:00 am

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

jere
Posts: 8
Joined: Thu Jun 13, 2019 2:02 pm

Re: Changing document_type from api

Post by jere » Thu Sep 05, 2019 10:33 pm

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.

User avatar
rosarior
Posts: 393
Joined: Tue Aug 21, 2018 3:28 am

Re: Changing document_type from api

Post by rosarior » 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.

mcrotsenburg
Posts: 4
Joined: Wed Sep 11, 2019 6:56 pm

Re: Changing document_type from api

Post by mcrotsenburg » Fri Sep 27, 2019 7:27 pm

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!

User avatar
rosarior
Posts: 393
Joined: Tue Aug 21, 2018 3:28 am

Re: Changing document_type from api

Post by rosarior » Tue Oct 01, 2019 3:50 am

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.

mcrotsenburg
Posts: 4
Joined: Wed Sep 11, 2019 6:56 pm

Re: Changing document_type from api

Post by mcrotsenburg » Wed Oct 09, 2019 8:54 pm

Awesome. You are a gentleman and a scholar!

Post Reply