This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including contentful-management
with all npm
packages installed. Try it out:
var contentful = require('contentful-management')
var client = contentful.createClient({
// This is the access token for this space. Normally you get both ID and the token in the Contentful web app
accessToken: 'YOUR_ACCESS_TOKEN'
})
// This API call will request a space with the specified ID
var space = await client.getSpace('spaceId')
// Now that we have a space, we can get entries from that space
await space.getEntries()
// let's get a content type
await space.getContentType('product')
.then((contentType) => {
// and now let's update its name
contentType.name = 'New Product'
return contentType.update()
.then((updatedContentType) => {
console.log('Update was successful')
return updatedContentType
})
})
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.