marspu1 / contentful-exporter.rb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contentful-Exporter

Description

This allows you to export structured JSON data from Contentful. You can then use contentful-importer to import the data into another space.

Installation

gem install contentful-exporter

This will install the contentful-exporter executable.

Usage

Before you can export your content from Contentful, you need to create a settings.yml file and fill in your credentials:

#Contentful
access_token: access_token
space_id: organization_id

A Contentful OAuth access token can be created using the Contentful Management API - documentation

Once you installed the Gem and created the YAML file with the settings you can invoke the tool using:

contentful-exporter --config-file settings.yml --action

Step by step

  1. Create YAML file with required parameters (eg. settings.yml):

    #PATH to all data
    data_dir: DEFINE_BEFORE_EXPORTING_DATA
    
    #Contentful credentials
    access_token: ACCESS_TOKEN
    space_id: SPACE_ID
  2. Now your content can be exported. It can be chosen to use one (default) or two parallel threads to speedup this process.

    Entries

    contentful-exporter --config-file settings.yml --export-entries

    or

    contentful-exporter --config-file settings.yml --export --threads 2

    Assets

    contentful-exporter --config-file settings.yml --export-assets

    or

    Content-types

    contentful-exporter --config-file settings.yml --export-content-types

    or

    All

    contentful-exporter --config-file settings.yml --export

Actions

To display all actions use the -h option:

contentful-exporter -h

--test-credentials

Before exporting any content you can verify that your credentials in the settings.yml file are correct:

contentful-exporter --config-file settings.yml --test-credentials

About

License:MIT License


Languages

Language:Ruby 100.0%