#
Import & Export data
#
Introduction
Rocket CLI utilizes contentful-export and contentful-import to export and import content, content models and assets from and to Contentful.
#
Export data
To export data from a Contentful environment, run the following command:
rocket contentful export
Rocket CLI will ask you to provide the following information:
- CMA token: Enter your Contentful Management API token. (How to create a token?)
- Space: Select the Contentful space you wish to export content from.
- Environment: Select the environment within the selected space.
These selections determine the content that will be exported. After making your choices, the export starts. Rocket CLI will create a JSON file containing the exported data, and it will be saved in your current working directory within the ./export/contentful
folder. The name of the generated file contains the environment name and a timestamp
#
Import data
This feature allows you to import files generated by rocket contentful export
or contentful-export.
To import data to a Contentful environment, run the following command:
rocket contentful import
Rocket CLI will ask you to provide the following information:
- CMA token: Enter your Contentful Management API token. (How to create a token?)
- Space: Select the Contentful space you wish to import content to.
- Environment: Select the environment within the selected space.
- Source: Select the file you wish to import.
Source: Files based in your current working directory within the ./export/contentful
folder.
These selections determine the content that will be imported. After making your choices, the import starts. Rocket CLI informs you about the success status of the import.
#
Data structure
The export feature generates a file with the following data structure, which is also required for importing:
{
"contentTypes": [],
"entries": [],
"assets": [],
"locales": [],
"tags": [],
"webhooks": [],
"roles": [],
"editorInterfaces": []
}