Content Management API > Fieldset
List all fieldsets of a model/block
Query parameters
fields object
Sparse fieldsets: for each entity type, the attributes and the relationships to return, separated by commas. Each entity declares its attributes and its relationships in its own schema.
fieldset string
Attributes and relationships to return for each fieldset that this endpoint returns.
Example:
"title,hint,collapsible,item_type"
Returns
Returns an array of resource objects of type fieldset
Examples
import { buildClient } from "@datocms/cma-client-node";
async function run() { const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const modelIdOrApiKey = "blog_post";
const fieldsets = await client.fieldsets.list(modelIdOrApiKey);
for (const fieldset of fieldsets) { // Check the 'Returned output' tab for the result ☝️ console.log(fieldset); }}
run();{ id: "93Y1C2sySkG4Eg0atBRIwg", title: "SEO-related fields", hint: "Please fill in these fields!", position: 1, collapsible: true, start_collapsed: false, item_type: { type: "item_type", id: "DxMaW10UQiCmZcuuA-IkkA" },}