Frequently Asked Questions
Frequently Asked Questions
REST API - limitations in destroying specific versions
Posted by Henri Huhtamäki (M-Files) on 18 December 2019 04:28 PM

Overview

There is a limitation in REST API destroy that may not be very straightforward.

Sample scenario:

  • you have a document type object (0) with ID 2 and say 5 versions
  • Using REST you check that object out and attempt to delete version 3 (by adding the target version at the end of DELETE call http://localhost/REST/objects/0/2/3) with allversions parameter set to false

You will encounter the following error:

"The object has been checked out in M-Files, but the version you are attempting to access is not the current checked-out version".

 

The reason for this behavior is documented in here, under Output.

https://developer.m-files.com/APIs/REST-API/Reference/resources/objects/type/objectid/version/

"Destroys the object version. As checked in versions cannot be destroyed this can only be performed on a checked out version and is equivalent to an undo checkout. Returns the new ObjectVersion information if it is still visible to the user."

So, in other words this means that the destroy endpoint can only destroy ALL versions, or it can destroy the current-checked-out version ONLY (i.e. undo checkout). There is no option to destroy a specific version from the object history with REST API.

(0 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako case