Components
Log in to add to favouritesA 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
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);
});