How to restore data to a previous version using redo API

In the previous post, we have seen how to store user account details. Let’s check how to restore data to a previous version.

redo function restore data to a previous version or specified version.

Let’s check how to change the version of an object using redo.

mutation {
  redo(type: "Object", id:"01gdnn769ewh4q06f67c7cgqrg")
}
#result
{
  "data": {
    "redo": true
  }
}

Above request restores data to previous version. type is the data type and id is the hypi.id of the object for which data needs to be restored.

If you need to restore to a specific version, just provide version number.

mutation {
  redo(type: "Object", id:"01gdnn769ewh4q06f67c7cgqrg", version: 10)
}