Skip to main content

A component determines a reusable schema added to content types which entries are then created from. Components contain a list of fields just like content types, and allow for a standardized schema for modelling content. Find out more about components.

Get a component

Gets an existing component by the component id or by passing a ComponentGetOptions object as an argument.

get(idOrOptions: string | ComponentGetOptions): Promise<Component>

Returns

A Promise that will resolve with a Component object.

Example

JavaScript
client.components.get('address')
.then(result => {
console.log('API call result: ', result);
})
.catch(error => {
console.log('API call fetch error: ', error);
});

client.components.get({
id: 'address',
versionStatus: 'published'
})
.then(result => {
console.log('API call result: ', result);
})
.catch(error => {
console.log('API call fetch error: ', error);
});

client.components.get({
id: 'address',
version: '1.2'
})
.then(result => {
console.log('API call result: ', result);
})
.catch(error => {
console.log('API call fetch error: ', error);
});

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request