Show examples in:
Javascript HTTP
Endpoint info
Available examples
Content Management API > Record

Retrieve information regarding changes between current and published versions of the record

Warning: Experimental API

Please note that this API method is marked as unstable and should be avoided in production environments. Changes may occur at any time without warning, potentially impacting your scripts. We recommend contacting our Support Team to explore alternative approaches that are safer and more reliable!

Returns

Returns a resource object of type item_current_vs_published_state

Examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const itemId = "hWl-mnkWRYmMCSTq4z_piQ";
const item = await client.items.currentVsPublishedState(itemId);
// Check the 'Returned output' tab for the result ☝️
console.log(item);
}
run();
{
id: "EnO-NF5wRy6K-cxGt1doqg",
current_version_locales: [""],
published_version_locales: [""],
changed_locales: [""],
added_locales: [""],
removed_locales: [""],
non_localized_fields_changed: true,
current_version_invalid_locales: [""],
current_version_non_localized_fields_invalid: true,
scheduled_publication: { type: "scheduled_publication", id: "34" },
scheduled_unpublishing: { type: "scheduled_unpublishing", id: "34" },
published_version: { type: "item_version", id: "59JSonvYTCOUDz_b7_6hvA" },
}