Skip to main content

Get a content type

Gets an existing content type by the content type id or by passing a ContentTypeGetOptions object as an argument.

get(idOrOptions: string | ContentTypeGetOptions): Promise<ContentType>

Returns

A Promise that will resolve with a ContentType object.

Example

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

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

client.contentTypes.get({
    id: 'movie',
    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