Assuming I understood correctly… the import/export functionality in Contentful CLI is not able to import any JSON file. It can only import very specific JSON structure - namely JSON files, that were created by exporting a JSON file with Contentful CLI.
Having said that, it is possible to use any JSON file as a source and import it via Content Management API, but that requires some custom code and the Contentful Management API client for the language of your choosing.
I was actually working on this yesterday and struggled to find a lot of relevant info for a CSV import, but I was able to piece some stuff together. Here is an example of a simple JavaScript import I created to import from a CSV file. Hopefully this might help as a starting point to modify for importing from JSON.
Interesting, thanks Blake, I did not know contentful supported CSV uploads.
I am just looking for a solution to upload entries into a content model. It has been a real struggle.
Sorry, to clarify, this was a script I wrote to read a local CSV file and create entries using the Content Management API. Contentful doesn’t support CSV or other uploads, as far as I’m aware, for importing content.
You would need to fill in your Contentful Space ID and create/add a management API key in your example-config.json. If the content model already exists, you can use the skip-content-model option:
contentful space import --config example-config.json --skip-content-model
Hey Guys, Apologies for jumping in here, Im trying to do something similar. Im trying to copy an Entry and all its nested children from one contentful space to another.
I have tried the Import/Export tool but it seems like it does not resolve nested entries.
I have no idea. I’ve gave up on ocntentful though atm and found wordpress way better and easier to use for cms for my purpose. It will always be free too
@syed.kazmi26 I don’t know for sure, but you might need to import the referenced entries first with the same IDs and then import the entry you wanted copy with the nested children.
I’ve started using this approach however running into a lot of issues with API call limits. Even when I add setIntervals in the loops.
For example I have another API feed (in JSON) I am looping through via a Node Express project but after 10 items I start getting the limit alerts. Is there a way around this? We will have 1500 items to import.
The next issue is checking if they exist, if they do update any new data. But that’s for stage 2.