Model & Fields
Node SDK Get Instance Model & Fields
Retrieval of content models and model fields.
These functions use these instances-api
endpoints:
All examples assume a properly authenticated SDK instance
Get all content models
try {
const res = await sdk.instance.getModels();
} catch (err) {
console.log(err);
}
Get a content model by ZUID
try {
const modelZUID = "6-..."; // Model ZUIDs begin with 6
const res = await sdk.instance.getModel(modelZUID);
} catch (err) {
console.log(err);
}
Get all fields for a content model
try {
const modelZUID = "6-...";
const res = await sdk.instance.getModelFields(modelZUID);
} catch (err) {
console.log(err);
}
Get a specific field by field ZUID for a content model
try {
const modelZUID = "6-...";
const fieldZUID = "12-..."; // Field ZUIDs begin 12
const res = await sdk.instance.getModelField(modelZUID, fieldZUID);
} catch (err) {
console.log(err);
}
Updated about 2 months ago