Coder Social home page Coder Social logo

contentful-export's Introduction

Contentful export 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 is a command line tool (CLI) that help you backup your published Content Model, Content and Assets or move them to a new Contentful space. It will support Editor Interfaces, Webhooks and Roles & Permissions in a future version.

To import your exported data, please refer to the contentful-import repository.

Installation

We recommend the installation of this CLI via npm:

npm install -g contentful-export

Usage and examples

Usage: contentful-export [options]

Options:
  --version           Show version number                              

  --space-id          ID of Space with source data           
                      [string] [required]

  --management-token  Management API token for the space to be exported.
                      [string] [required]

  --export-dir        Defines the path for storing the export json file
                      (default path is the current directory) [string]

  --max-allowed-limit How many item per page per request default 1000 [number]

  --include-drafts    Export Drafts entiries, a preview token needs to be provided when the value is true [boolean]

  --download-assets   Download the assets along with the exported data [boolean]
 
  --rate-limit                    How many request per period of time, default 6 [number]
  
  --rate-limit-period             How much time to wait before retry in ms, default 1000 [number]     
  
  --config            Configuration file with required values

The --management-token parameter allows you to specify a token used for both spaces. If you request a token from here and your user account has access to both spaces, this should be enough.

Check the example-config.json file for an example of what a configuration file looks like. If you use the configuration file, you don't need to specify the other options for tokens and space ids.

Example

contentful-export \
  --space-id spaceID \
  --management-token managementToken

or

contentful-export --config example-config.json

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

Exported data

This is an overview of the exported data:

{
  "contentTypes": [],
  "entries": [],
  "locales": [],
  "assets": [],
  "webhooks": [],
  "editorInterfaces": [],
	"roles": []
}

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:

var spaceExport = require('contentful-export')

spaceExport(options)
.then((output) => {
  console.log('space data', output)
})
.catch((err) => {
  console.log('oh no! errors occurred!', err)
})

The options object can contain any of the CLI options, but written with a camelCase pattern instead, and no dashes. For example --space-id would become spaceId.

Another option is errorLogFile, the location of a file to log errors to.

Limitations

  • This tool exports 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 export the content exported by this tool into an empty space. We currently do not support merging content into pre-existing 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

contentful-export's People

Contributors

floelhoeffel avatar jhilden avatar khaledgarbaya avatar rngadam avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.