9.4.55 • Published 3 days ago

contentful-import v9.4.55

Weekly downloads
39,501
License
MIT
Repository
github
Last release
3 days ago

Contentful import tool

npm CircleCI

semantic-release js-standard-style

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 library helps you to import files generated by contentful-export to a destination space.

: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 import command documentation to learn more about how to use this as command line tool.

:cloud: Pre-requisites && Installation

Pre-requisites

  • Node LTS

Installation

npm install contentful-import

:hand: Usage

const contentfulImport = require('contentful-import')

const options = {
  content: {entries:..., contentTypes:..., locales:...},
  spaceId: '<space_id>',
  managementToken: '<content_management_api_key>',
  ...
}

contentfulImport(options)
  .then(() => {
    console.log('Data imported successfully')
  })
  .catch((err) => {
    console.log('Oh no! Some errors occurred!', err)
  })

Using ESM:

import spaceImport from 'contentful-import';

or

const contentfulImport = require('contentful-import')

const options = {
  contentFile: '/path/to/result/of/contentful-export.json',
  spaceId: '<space_id>',
  managementToken: '<content_management_api_key>',
  ...
}

contentfulImport(options)
  .then(() => {
    console.log('Data imported successfully')
  })
  .catch((err) => {
    console.log('Oh no! Some errors occurred!', err)
  })

Import an environment

const contentfulImport = require('contentful-import')

const options = {
  contentFile: '/path/to/result/of/contentful-export.json',
  spaceId: '<space_id>',
  managementToken: '<content_management_api_key>',
  environmentId: '<environment_id>',
  ...
}

contentfulImport(options)
...

:gear: Configuration options

Basics

spaceId string

ID of the space to import into

environmentId string

ID of the environment in the destination space

managementToken string

Contentful management API token for the space to be imported to

contentFile string

Path to JSON file that contains data to be import to your space

content object

Content to import. Needs to match the expected structure (See below)

Filtering

contentModelOnly boolean

Import content types only

skipContentModel boolean

Skip importing of content types and locales

skipLocales boolean

Skip importing of locales

skipContentPublishing boolean

Skips content publishing. Creates content but does not publish it

Assets

uploadAssets boolean

Upload local asset files downloaded via the downloadAssets option of the export. Requires assetsDirectory

assetsDirectory string

Path to a directory with an asset export made using the downloadAssets option of the export. Requires uploadAssets

timeout number

Time between retries on asset processing

retryLimit number

Maximum number of retries for asset processing

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

rateLimit number

Maximum requests per second used for API requests

headers object

Additional headers to attach to the requests.

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.

config string

Path to a JSON file with the configuration options. This file will be merged with the options passed to the function. The options passed to the function will take precedence over the ones in the config file.

:rescue_worker_helmet: Troubleshooting

Unable to connect to Contentful through your Proxy? Try to set the rawProxy option to true.

contentfulImport({
  proxy: 'https://cat:dog@example.com:1234',
  rawProxy: true,
  ...
})

:card_file_box: Expected input data structure

The data to import should be structured like this:

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

Note: tags are not available for all users. If you do not have access to this feature, any tags included in your import data will be skipped.

:bulb: Importing to a space with existing content

  • Both source space and destination space must share the same content model structure. In order to achieve that, please use contentful-migration.
  • Content transformations are also not supported, please use contentful-migration.
  • Entities existence are determined based on their ID:
    • If an entity does not exist in the destination space, it will be created.
    • If an entity already exists in the destination space, it will be updated.
  • Publishing strategy:
    • If an entity is in draft, it will be created as draft in the destination space.
    • If an entity is published and has pending changes (updated) in the source space, it will be published with the latest changes in the destination space.

:warning: Limitations

  • This tool currently does not support the import of space memberships.
  • This tool currently does not support the import of roles.
  • This tool is expecting the target space to have the same default locale as your previously exported space.
  • Imported webhooks with credentials will be imported as normal webhooks. Credentials should be added manually afterwards.
  • Imported webhooks with secret headers will be imported without these headers. Secret headers should be added manuall 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

9.4.55

3 days ago

9.4.54

29 days ago

9.4.53

1 month ago

9.4.52

1 month ago

9.4.51

1 month ago

9.4.50

1 month ago

9.4.48

2 months ago

9.4.49

2 months ago

9.4.47

2 months ago

9.4.46

2 months ago

9.4.45

2 months ago

9.4.44

2 months ago

9.4.43

2 months ago

9.4.42

2 months ago

9.4.41

2 months ago

9.4.40

2 months ago

9.4.39

3 months ago

9.4.38

3 months ago

9.4.37

3 months ago

9.4.36

3 months ago

9.4.35

3 months ago

9.4.34

3 months ago

9.4.33

3 months ago

9.4.32

3 months ago

9.4.31

3 months ago

9.4.30

3 months ago

9.4.29

4 months ago

9.4.28

4 months ago

9.4.26

4 months ago

9.4.27

4 months ago

9.4.25

4 months ago

9.4.24

4 months ago

9.4.23

4 months ago

9.4.22

4 months ago

9.4.21

4 months ago

9.4.19

4 months ago

9.4.20

4 months ago

9.4.18

4 months ago

9.4.17

5 months ago

9.4.16

5 months ago

9.4.15

5 months ago

9.4.14

5 months ago

9.4.13

5 months ago

9.0.9

8 months ago

9.0.8

8 months ago

9.0.7

8 months ago

9.0.6

8 months ago

9.0.5

8 months ago

9.0.4

9 months ago

9.0.3

9 months ago

9.0.2

9 months ago

9.0.1

9 months ago

9.0.0

9 months ago

9.2.2

7 months ago

9.2.1

7 months ago

9.4.12

5 months ago

9.4.11

6 months ago

9.4.10

6 months ago

9.1.0

7 months ago

9.3.4

7 months ago

8.5.63

9 months ago

9.3.3

7 months ago

8.5.62

10 months ago

9.3.2

7 months ago

9.3.1

7 months ago

9.3.0

7 months ago

9.2.0

7 months ago

9.4.6

6 months ago

9.4.5

6 months ago

9.4.4

6 months ago

9.4.3

6 months ago

9.4.2

7 months ago

9.4.1

7 months ago

9.4.0

7 months ago

9.4.9

6 months ago

9.4.8

6 months ago

9.4.7

6 months ago

9.0.17

8 months ago

9.0.16

8 months ago

9.0.19

8 months ago

9.0.18

8 months ago

9.0.13

8 months ago

9.0.12

8 months ago

9.0.15

8 months ago

9.0.14

8 months ago

9.0.11

8 months ago

9.0.10

8 months ago

9.0.20

7 months ago

9.0.21

7 months ago

8.5.61

10 months ago

8.5.60

10 months ago

8.5.59

10 months ago

8.5.58

11 months ago

8.5.55

12 months ago

8.5.57

11 months ago

8.5.56

11 months ago

8.5.49

1 year ago

8.5.48

1 year ago

8.5.47

1 year ago

8.5.46

1 year ago

8.5.54

12 months ago

8.5.53

12 months ago

8.5.52

12 months ago

8.5.51

12 months ago

8.5.50

12 months ago

8.5.44

1 year ago

8.5.43

1 year ago

8.5.45

1 year ago

8.5.42

1 year ago

8.5.41

1 year ago

8.5.40

1 year ago

8.5.39

1 year ago

8.5.38

1 year ago

8.5.37

1 year ago

8.5.36

1 year ago

8.5.35

1 year ago

8.5.33

1 year ago

8.5.32

1 year ago

8.5.34

1 year ago

8.5.29

1 year ago

8.5.28

1 year ago

8.5.27

1 year ago

8.5.26

1 year ago

8.5.31

1 year ago

8.5.30

1 year ago

8.5.22

1 year ago

8.5.21

1 year ago

8.5.20

1 year ago

8.5.25

1 year ago

8.5.24

1 year ago

8.5.23

1 year ago

8.5.19

1 year ago

8.5.18

1 year ago

8.5.17

1 year ago

8.5.16

1 year ago

8.5.15

1 year ago

8.5.14

1 year ago

8.3.9

2 years ago

8.4.0

2 years ago

8.5.4

1 year ago

8.5.3

1 year ago

8.5.6

1 year ago

8.5.5

1 year ago

8.5.0

2 years ago

8.5.2

2 years ago

8.5.1

2 years ago

8.5.8

1 year ago

8.5.7

1 year ago

8.5.9

1 year ago

8.5.11

1 year ago

8.5.10

1 year ago

8.5.13

1 year ago

8.5.12

1 year ago

8.3.6

2 years ago

8.3.5

2 years ago

8.3.8

2 years ago

8.3.7

2 years ago

8.3.4

2 years ago

8.3.3

2 years ago

8.3.2

2 years ago

8.3.1

2 years ago

8.2.29

2 years ago

8.3.0

2 years ago

8.2.25

2 years ago

8.2.26

2 years ago

8.2.27

2 years ago

8.2.28

2 years ago

8.2.19

3 years ago

8.2.20

3 years ago

8.2.21

3 years ago

8.2.22

3 years ago

8.2.23

3 years ago

8.2.24

3 years ago

8.2.14

3 years ago

8.2.15

3 years ago

8.2.16

3 years ago

8.2.17

3 years ago

8.2.18

3 years ago

8.2.12

3 years ago

8.2.13

3 years ago

8.2.11

3 years ago

8.2.10

3 years ago

8.2.9

3 years ago

8.2.7

3 years ago

8.2.8

3 years ago

8.2.6

3 years ago

8.2.5

3 years ago

8.2.3

3 years ago

8.2.4

3 years ago

8.2.2

3 years ago

8.2.1

3 years ago

8.2.0

3 years ago

8.1.25

3 years ago

8.1.24

3 years ago

8.1.23

3 years ago

8.1.22

3 years ago

8.1.21

3 years ago

8.1.20

3 years ago

8.1.19

3 years ago

8.1.18

3 years ago

8.1.17

3 years ago

8.1.16

3 years ago

8.1.15

3 years ago

8.1.11

3 years ago

8.1.10

3 years ago

8.1.13

3 years ago

8.1.12

3 years ago

8.1.14

3 years ago

8.1.8

3 years ago

8.1.7

3 years ago

8.1.9

3 years ago

8.1.2

3 years ago

8.1.1

3 years ago

8.1.4

3 years ago

8.1.3

3 years ago

8.1.6

3 years ago

8.1.5

3 years ago

8.1.0

3 years ago

8.0.6

3 years ago

8.0.5

3 years ago

8.0.4

3 years ago

8.0.3

3 years ago

8.0.2

3 years ago

8.0.1

3 years ago

7.9.42

3 years ago

8.0.0

3 years ago

7.9.41

3 years ago

7.9.40

3 years ago

7.9.39

3 years ago

7.9.38

3 years ago

7.9.37

3 years ago

7.9.36

3 years ago

7.9.35

3 years ago

7.9.34

3 years ago

7.9.33

3 years ago

7.9.32

3 years ago

7.9.31

3 years ago

7.9.30

3 years ago

7.9.29

3 years ago

7.9.28

3 years ago

7.9.27

3 years ago

7.9.26

3 years ago

7.9.25

3 years ago

7.9.24

3 years ago

7.9.23

3 years ago

7.9.22

3 years ago

7.9.21

3 years ago

7.9.20

3 years ago

7.9.19

3 years ago

7.9.18

3 years ago

7.9.17

3 years ago

7.9.16

3 years ago

7.9.15

4 years ago

7.9.14

4 years ago

7.9.13

4 years ago

7.9.12

4 years ago

7.9.10

4 years ago

7.9.11

4 years ago

7.9.9

4 years ago

7.9.7

4 years ago

7.9.8

4 years ago

7.9.6

4 years ago

7.9.5

4 years ago

7.9.4

4 years ago

7.9.3

4 years ago

7.9.2

4 years ago

7.9.1

4 years ago

7.9.0

4 years ago

7.8.7

4 years ago

7.8.6

4 years ago

7.8.5

4 years ago

7.8.4

4 years ago

7.8.3

4 years ago

7.8.2

4 years ago

7.8.1

4 years ago

7.8.0

4 years ago

7.7.18

4 years ago

7.7.17

4 years ago

7.7.16

4 years ago

7.7.15

4 years ago

7.7.14

4 years ago

7.7.13

4 years ago

7.7.12

4 years ago

7.7.11

4 years ago

7.7.10

4 years ago

7.7.9

4 years ago

7.7.8

4 years ago

7.7.7

4 years ago

7.7.6

4 years ago

7.7.5

4 years ago

7.7.4

4 years ago

7.7.3

4 years ago

7.7.2

4 years ago

7.7.1

4 years ago

7.7.0

4 years ago

7.6.2

4 years ago

7.6.1

5 years ago

7.6.0

5 years ago

7.5.1

5 years ago

7.4.5

5 years ago

7.4.4

5 years ago

7.5.0

5 years ago

7.4.3

5 years ago

7.4.2

5 years ago

7.4.1

6 years ago

7.4.0

6 years ago

7.3.0

6 years ago

7.2.0

6 years ago

7.1.0

6 years ago

7.1.0-beta2

6 years ago

7.0.4

6 years ago

7.1.0-beta1

6 years ago

7.1.0-beta0

6 years ago

7.0.3

6 years ago

7.0.2

6 years ago

7.0.1

6 years ago

7.0.0

6 years ago

6.2.3

6 years ago

7.0.0-beta0

6 years ago

6.2.2

6 years ago

6.2.1

6 years ago

6.2.0

6 years ago

6.1.2

6 years ago

6.1.1

6 years ago

6.1.0

6 years ago

6.0.2

6 years ago

6.0.1

6 years ago

6.0.0

6 years ago

5.0.2-beta4

6 years ago

5.0.2-beta3

6 years ago

5.0.2-beta2

7 years ago

4.5.7

7 years ago

5.0.2-beta1

7 years ago

5.0.2-beta0

7 years ago

4.5.6

7 years ago

5.0.1

7 years ago

5.0.0

7 years ago

4.5.5

7 years ago

4.5.4

7 years ago

4.5.3

7 years ago

4.5.2

7 years ago

4.5.1

7 years ago

4.5.0

7 years ago

4.4.3

7 years ago

4.4.2

7 years ago

4.4.1

7 years ago

4.4.0

7 years ago

4.3.0

7 years ago

4.2.0

7 years ago

4.1.1

7 years ago

4.1.0

7 years ago

4.0.0

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

2.5.0

7 years ago

2.4.0

7 years ago

2.3.0

7 years ago

2.2.0

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.0.0

8 years ago