Programmatically work with versioning


#1

We have a customer that need to be able to roll back to certain versions of a given node through a service-API. I have not been able to figure how this is done via documentation, discuss, or Slack. I suspect this is not supported yet, and if so, I wonder if it’s in the backlog, and how far away it is.


#2

Ok, saw the response in Slack now:

Well there is no public API for it now.
But we could add two new functions “getVersions” and “setActiveVersion” in lib-content. I will forward the request.

So hopefully it will come soon :slight_smile:


#3

If you could, what kind of functions do you think you would need? getVersions(contentId), restoreVersion(versionId), any else (like deleteVersion etc)?


#4

getVersions(contentId) and restoreVersion(versionId) would help a lot. Do not think deleteVersion is needed in the first case.

To elaborate a bit: We need to get a specific version by an external id, so using getVersions and loop through the versions would work; of course, if we could limit the number of versions returned by supplying some kind of query, that would be even more efficient, I guess. (E.g. getVersions(contentId, params?) where params has some similarity with content.query(params).)

We also need to handle certain edgecases; what if a node has been moved, will the change in path be reflected in versions? What about links with other nodes, that might’ve been deleted between versions, should these be recreated? What about the edge cases that might arise from the recreation of those nodes?

In short: I understand that this functionality might be difficult to get “just right”. But it would be very useful for us, even with some caveats.


#5

deleteVersion() would be helpfull as long as XP keeps unlimited versions of everything :slight_smile: then one could possible create a task that deletes old versions


#6

We are making improvements on version handling for 7.0 - more news will come later!


#7