Managing Object Entry Versions
Liferay DXP 2025.Q4+/Portal 2026.Q1+
Object entry versioning is used in Liferay’s Content Management System (CMS). To use versioning with a custom object’s entries, you must enable versioning in the object definition using the API, by setting the objectEntryVersioning attribute to true. Then you can call the versioning API endpoints. Versioning integration is not available in the out-of-the-box object entry management or display features like collections, form container, or data set manager.
When you publish an Object definition, REST APIs are generated for managing its entries. These APIs include versioning endpoints. You can use the versioning endpoints if the object definition enables versioning.
When versioning is enabled in the definition, updating an entry using either PATCH or PUT creates a new version of the object entry. Here’s an overview of the versioning endpoints for an individual entry:
| Action | Example Endpoint | Versioning Behavior |
|---|---|---|
| Update an entry with PATCH or PUT. | /o/c/ables/by-external-reference-code/ | A new entry version is created. |
| Get an entry’s versions | /o/c/ables/by-external-reference-code//versions | Pass in the ERC to get all of the entry’s existing versions. |
| Get a version | /o/c/ables/by-external-reference-code//by-version/ | Pass in the ERC and the version number to get a single version. |
| Restore a specific version | /o/c/ables/by-external-reference-code//by-version//restore | Brings back an earlier version so it’s the latest. This creates a new version of the entry based on an older version. You cannot update the entry’s fields while restoring it. |
| Copy a version. | /o/c/ables/by-external-reference-code//by-version//copy | Create a new entry with a unique ERC based on an entry version. |
| Delete a version. | /o/c/ables/by-external-reference-code//by-version/ | The previous version is now the latest version. If none exists, the entry is deleted. |
In addition, you can get all the definition’s latest approved versions using the /o/c/ables/approved endpoint.
You can test the endpoints. First set up a Liferay instance.
Preparing Liferay
Start a new Liferay instance by running
docker run -it -m 8g -p 8080:8080 liferay/portal:7.4.3.132-ga132
Sign in to Liferay at http://localhost:8080. Use the email address test@liferay.com and the password test. When prompted, change the password to learn.
Run the following commands to download and unzip the provided sample code:
curl https://resources.learn.liferay.com/examples/liferay-j5b2.zip -O
unzip liferay-j5b2.zip
Then, navigate to liferay-j5b2/curl and populate some data by running this script:
./populate_j5b2.sh
This creates an object definition with versioning enabled, creates three entries, and updates one with a PUT call to create a new version. One of the entries is in draft status.

Calling the Versioning APIs
You can run shell scripts that execute curl commands to explore these GET endpoints:
-
Get all the versions for the entry matching the ERC:
./Ables_GET_Versions_ByExternalReferenceCode.sh ABLE_1ABLE_1has two versions, named Able 1.0 and Able 1.1. -
Now use the endpoint for retuning one version by specifying the version number:
./Ables_GET_Version_ByExternalReferenceCode.sh ABLE_1 1Only the
ABLE_1version with the name Able 1.0 is returned. -
Next, get all of the latest approved versions for the object definition:
./Ables_GET_Approved.shTwo Able entry versions are returned, named Able 1.1 and Able 2.0. Able 3.0 has one version with the status
draft, so it’s not returned. Able 1 has two versions, but this endpoint only returns the latest approved version.
These calls demonstrate additional actions on object entry versions:
-
Restore Able 1.0 to the latest version:
./Ables_PUT_Restore_ByExternalReferenceCode.sh ABLE_1 1You can restore an older version with this call, but you cannot update fields at the same time.
-
Copy Able 1.1 (i.e., version 2 of the
ABLE_1entry):./Ables_POST_Copy_ByExternalReferenceCode.sh ABLE_1 2This copies the version as a new draft entry (if drafts are enabled for the object definition).

-
Delete version 2 from ABLE_1:
./Ables_DELETE_Version.sh ABLE_1 2 -
Set the status of the first
ABLE_1version to Expired:./Ables_POST_Expire_ByExternalReferenceCode.sh ERC 1If you expire the latest version it’s marked with the status expired (3) and the entry’s expiration date is set to the current date.