Im using the Content-Managemen-API provided by contentful.
Im using this to create a single entry in a space and this works fine:
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getSpace('<space_id>')
.then((space) => space.createEntry('<content_type_id>', {
fields: {
title: { 'de-DE': 'Zusammenfassung', 'en-US': 'Summary' },
slug: { 'en-US': 'example-app-summary' },
modules: { 'en-US': [Object] }
}
}))
.then((entry) => console.log(entry))
.catch(console.error)
My Problem:
I want to create a nested entry. Which means an entry contains another entry and so on.
I have tried the sending contentful this data strcuture:
fields: {
title: { 'de-DE': 'Zusammenfassung', 'en-US': 'Summary' },
slug: { 'en-US': 'example-app-summary' },
modules: { 'en-US': [Object] }
}
The modules property contains another entries meta-data shown below:
{ type: 'Link', linkType: 'Entry', id: '4Ng6zmj9e8Sw0eaYKQM8Es' }
When I do a POST request with the above data, it does create a Entry but the nested entries don't work and I see this.
Question:
Anyone know how I can create an entry with nested items? Im not sure what data structure to send to the API.