I have two environments - “master” and “dev” . Have modified one content model - “menu” in “dev” environment and before importing that to “master”, i want to export the existing “menu” content model from “master”, as in case of any failure, i can import back the older “menu” content model.
Is there any way to export a specific content model alone. I was looking for content-cli options, but with “–query-entries”, its exporting all content models in that environment.
Does it work? I have a same use case. It is very helpful to be able to export specific content modules from one space to other. I have no luck with -query-entries it always exports entire space which is not what I need always. Can someone help with this.
The import/export CLI is often used to perform backups and restoration of data, and it is recommended to have an empty space/environment when performing an import.
For the particular use case of migrating content models modifications from dev to master, it is recommended to script a migration using the CLI:
Migrations are quite easy to write, and the CLI export can be used on both environments to highlight the differences using a text/JSON diff tool. Those kind of tools are generally available in Programming editors, or online, such as: https://jsoncompare.org/
Thanks for your answer. It helps but must be combined with another one as this worked only when import states the following:
contentful space export --space-id=“SPACE_ID” --environment-id=“ENV_ID” --query-entries “sys.contentType.sys.id[in]=MODEL_ID,OTHER_MODEL_ID” --query-assets ‘sys.id=00000’ --skip-webhooks true --skip-roles true
otherwise it exports all assets and imports it later event if you opted only for a one content type and not assets at all. But simply removing all redundant data from export file is also an option that helped me as I wanted only import specific entries and nothing else so providing file like: