Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Field

Delete a field

Returns

Returns a resource object of type field

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 fieldIdOrApiKey = "blog_post::title";
7
8
const field = await client.fields.destroy(fieldIdOrApiKey);
9
10
// Check the 'Returned output' tab for the result ☝️
11
console.log(field);
12
}
13
14
run();
1
{
2
id: "Pkg-oztERp6o-Rj76nYKJg",
3
label: "Title",
4
field_type: "string",
5
api_key: "title",
6
localized: true,
7
validators: { required: {} },
8
position: 1,
9
hint: "This field will be used as post title",
10
default_value: { en: "A default value", it: "Un valore di default" },
11
appearance: {
12
editor: "single_line",
13
parameters: { heading: false },
14
addons: [{ id: "1234", field_extension: "lorem_ipsum", parameters: {} }],
15
},
16
deep_filtering_enabled: true,
17
item_type: { type: "item_type", id: "DxMaW10UQiCmZcuuA-IkkA" },
18
fieldset: null,
19
}