UNPKG

793 BJavaScriptView Raw
1var contentful = require('contentful-management')
2var client = contentful.createClient({
3 // This is the access token for this space. Normally you get both ID and the token in the Contentful web app
4 accessToken: 'YOUR_ACCESS_TOKEN',
5})
6
7async function run() {
8 // This API call will request a space with the specified ID
9 var space = await client.getSpace('spaceId')
10 // Now that we have a space, we can get entries from that space
11 await space.getEntries()
12
13 // let's get a content type
14 await space.getContentType('product').then((contentType) => {
15 // and now let's update its name
16 contentType.name = 'New Product'
17 return contentType.update().then((updatedContentType) => {
18 console.log('Update was successful')
19 return updatedContentType
20 })
21 })
22}
23
24run()