1 | var contentful = require('contentful-management')
|
2 | var 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 | // This API call will request a space with the specified ID
|
7 | var space = await client.getSpace('spaceId')
|
8 | // Now that we have a space, we can get entries from that space
|
9 | await space.getEntries()
|
10 |
|
11 | // let's get a content type
|
12 | await space.getContentType('product')
|
13 | .then((contentType) => {
|
14 | // and now let's update its name
|
15 | contentType.name = 'New Product'
|
16 | return contentType.update()
|
17 | .then((updatedContentType) => {
|
18 | console.log('Update was successful')
|
19 | return updatedContentType
|
20 | })
|
21 | })
|