@trimble-creative-strategy/contentful-export-aws v1.0.12
@trimble-creative-strategy/contentful-export-aws
This is a fork of the contentful-export-aws repo so that we could edit. The first edit was foldername specificity.
contentful-export-aws
This is a fork of the Contentful Export Tool to write the Contentful backup to AWS S3 instead of a local file system.
Usage
$ npm install @trimble-creative-strategy/contentful-export-aws
const contentfulExport = require('contentful-export')
const options = {
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
awsAccessKey: '<aws_access_key',
awsSecret: '<aws_secret>',
awsRegion: 'us-east-1|<aws_region>',
awsBucket: '<aws_bucket>',
...
};
(async function() {
await contentfulExport(options);
console.log('Completed export');
})();
Contentful export tool (Original README)
Contentful provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.
This is a library that help you backup your Content Model, Content and Assets or move them to a new Contentful space. It will support Roles & Permissions in a future version.
To import your exported data, please refer to the contentful-import repository.
:exclamation: Usage as CLI
We moved the CLI version of this tool into our Contentful CLI. This allows our users to use and install only one single CLI tool to get the full Contentful experience.
Please have a look at the Contentful CLI export command documentation to learn more about how to use this as command line tool.
:cloud: Installation
npm install contentful-export
:hand: Usage
const contentfulExport = require('contentful-export')
const options = {
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
...
}
contentfulExport(options)
.then((result) => {
console.log('Your space data:', result)
})
.catch((err) => {
console.log('Oh no! Some errors occurred!', err)
})
Querying
To scope your export, you are able to pass query parameters. All search parameters of our API are supported as documented in our API documentation.
const contentfulExport = require('contentful-export')
const options = {
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
queryEntries: 'content_type=<content_type_id>'
}
contentfulExport(options)
...
The Export tool also support multiple inline queries.
const contentfulExport = require('contentful-export')
const options = {
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
queryEntries: [
'content_type=<content_type_id>',
'sys.id=<entry_id>'
]
}
contentfulExport(options)
...
queryAssets
uses the same syntax as queryEntries
Export an environment
const contentfulExport = require('contentful-export')
const options = {
spaceId: '<space_id>',
managementToken: '<content_management_api_key>',
environmentId: '<environment_id>'
}
contentfulExport(options)
...
:gear: Configuration options
Basics
spaceId
string
ID of the space with source data
environmentId
string
ID of the environment in the source space
managementToken
string
Contentful management API token for the space to be exported
Output
exportDir
string
Defines the path for storing the export JSON file
saveFile
boolean
Save the export as a JSON file
contentFile
string
The filename for the exported data
Filtering
includeDrafts
boolean
Include drafts in the exported entries
includeArchived
boolean
Include archived entries in the exported entries
skipContentModel
boolean
Skip exporting content models
skipContent
boolean
Skip exporting assets and entries
skipRoles
boolean
Skip exporting roles and permissions
skipWebhooks
boolean
Skip exporting webhooks
contentOnly
boolean
Only export entries and assets
queryEntries
array
Only export entries that match these queries
queryAssets
array
Only export assets that match these queries
downloadAssets
boolean
Download actual asset files
Connection
host
string
The Management API host
proxy
string
Proxy configuration in HTTP auth format: host:port
or user:password@host:port
rawProxy
boolean
Pass proxy config to Axios instead of creating a custom httpsAgent
maxAllowedLimit
number
The number of items per page per request
Other
errorLogFile
string
Full path to the error log file
useVerboseRenderer
boolean
Display progress in new lines instead of displaying a busy spinner and the status in the same line. Useful for CI.
:rescue_worker_helmet: Troubleshooting
- Unable to connect to Contentful through your proxy? Try to set the
rawProxy
option totrue
.
contentfulExport({
proxy: 'https://cat:dog@example.com:1234',
rawProxy: true,
...
})
:card_file_box: Exported data structure
This is an overview of the exported data:
{
"contentTypes": [],
"entries": [],
"assets": [],
"locales": [],
"webhooks": [],
"roles": [],
"editorInterfaces": []
}
:warning: Limitations
- This tool currently does not support the export of space memberships.
- Exported webhooks with credentials will be exported as normal webhooks. Credentials should be added manually afterwards.
- If you have custom UI extensions, you need to reinstall them manually in the new space.
:memo: Changelog
Read the releases page for more information.
:scroll: License
This project is licensed under MIT license