Skip to content

Node module that uses the data provided by contentful-export to import it to contentful space

License

Notifications You must be signed in to change notification settings

dustinWeaver/contentful-import

 
 

Repository files navigation

Contentful import tool

npm Build Status Coverage Status Dependency Status devDependency Status

semantic-release js-standard-style

https://www.contentful.com is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.

This Command Line Tool (CLI) helps you to import files generated by the contentful-export tool to new and empty Contentful spaces.

Installation

We recommend you install the CLI via npm:

npm install -g contentful-import

Usage and examples

Usage: bin/contentful-import [options]

Options:
  --version                 Show version number [number]
  --space-id                ID of the destination space [string] [required]
  --management-token        Management API token for the destination space [string] [required]
  --content-file            json file that contains data to be import to your space [string] [required]
  --skip-content-model      Skips content types and locales. Copies only entries and assets [boolean]
  --skip-content-publishing Skips content publishing. Creates content but does not publish it [boolean]
  --skip-locales            Skips locales. Must be used with content-model-only. Copies only content-types [boolean]
  --content-model-only      Skips content types and locales. Copies only entries and assets
  --config                  Configuration file with required values

Example

contentful-import \
  --space-id spaceID \
  --management-token managementToken \
  --content-file exported-file.json \

or

contentful-import --config example-config.json

You can create your own configuration file based on the example-config.json file.

Usage as a library

While this tool is intended for use as a command line tool, you can also use it as a Node library:

let spaceImport = require('contentful-import')
let options = {
    content: {entries:..., contentTypes:..., locales:...},
    spaceId: 'SPACE_ID',
    managementToken: 'MANAGEMENT_TOKEN'
}
spaceImport(options)
.then((output) => {
  console.log('Data Imported successfully')
})
.catch((err) => {
  console.log('oh no! errors occurred!', err)
})

Limitations

  • This tool imports only your published Content Model, Content and Assets. It will support Editor Interfaces, Webhooks and Roles & Permissions in a future version. Draft entries are not supported.
  • You can only import content to an empty space. It does not support merging content into pre-existent spaces.
  • If you have custom widgets, you need to reinstall them manually in the new space.

Changelog

Read the releases page for more information.

License

This project is licensed under MIT license

About

Node module that uses the data provided by contentful-export to import it to contentful space

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%