Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Record

Duplicate a record

Returns

Returns a resource object of type item

Examples

1
import { buildClient } from "@datocms/cma-client-node";
2
3
async function run() {
4
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
5
6
const itemId = "hWl-mnkWRYmMCSTq4z_piQ";
7
8
const item = await client.items.duplicate(itemId);
9
10
// Check the 'Returned output' tab for the result ☝️
11
console.log(item);
12
}
13
14
run();
1
{
2
id: "hWl-mnkWRYmMCSTq4z_piQ",
3
title: "My first blog post!",
4
content: "Lorem ipsum dolor sit amet...",
5
category: "24",
6
image: {
7
alt: "Alt text",
8
title: "Image title",
9
custom_data: {},
10
focal_point: null,
11
upload_id: "20042921",
12
},
13
meta: {
14
created_at: "2020-04-21T07:57:11.124Z",
15
updated_at: "2020-04-21T07:57:11.124Z",
16
published_at: "2020-04-21T07:57:11.124Z",
17
first_published_at: "2020-04-21T07:57:11.124Z",
18
publication_scheduled_at: "2020-04-21T07:57:11.124Z",
19
unpublishing_scheduled_at: "2020-04-21T07:57:11.124Z",
20
status: "published",
21
is_current_version_valid: true,
22
is_published_version_valid: true,
23
current_version: "4234",
24
stage: null,
25
},
26
item_type: { type: "item_type", id: "DxMaW10UQiCmZcuuA-IkkA" },
27
}