Import

Ask about this Page
Copy for AI
View as Markdown

Manage commercetools Import API containers, import operations, and import summaries from the terminal.

The import topic provides commands for working with the commercetools Import API. It covers three resources:
  • Import containers define the scope and configuration of an import.
  • Import operations are the individual records being imported.
  • Import summaries give an aggregate view of the import results per container.
Commands that call the API need an authenticated session. For how to log in, see Authentication.

Import containers

Import containers define the namespace for a set of import operations.

Manage import containersbash
# List all import containers
commercetools import import-containers list [--limit <n>] [--offset <n>]

# Get an import container by key
commercetools import import-containers get --key <key>

# Create an import container
commercetools import import-containers create --body '{"key":"my-container","resourceType":"product-drafts"}'

# Update an import container
commercetools import import-containers update \
  --key <key> \
  --version <n> \
  --actions '[{"action":"changeResourceType","resourceType":"prices"}]'

# Delete an import container
commercetools import import-containers delete --key <key>

Flag reference

list

FlagDescriptionDefault
--limitMaximum number of results20
--offsetNumber of results to skip0

get / delete

FlagDescription
--keyImport container key (required)

create

FlagDescription
--bodyJSON string or path to a JSON file prefixed with @

update

FlagDescription
--keyImport container key
--versionCurrent version of the container
--actionsJSON array of update actions or path to a JSON file prefixed with @

Import operations

Import operations represent individual resources being imported into a container.

Manage import operationsbash
# List import operations for a container
commercetools import import-operations list \
  --container-key <key> \
  [--limit <n>] \
  [--offset <n>]

# Get a specific import operation by ID
commercetools import import-operations get --id <id>

Flag reference

list

FlagDescriptionDefault
--container-keyKey of the import container (required)
--limitMaximum number of results20
--offsetNumber of results to skip0

get

FlagDescription
--idImport operation ID (required)

Import summaries

Import summaries provide an aggregate view of all import operations in a container, grouped by status.

Get an import summarybash
# Get the import summary for a container
commercetools import import-summaries get --container-key <key>

Flag reference

FlagDescription
--container-keyKey of the import container (required)

Examples

Set up and monitor a product importbash
# 1. Create an import container
commercetools import import-containers create \
  --body '{"key":"product-import","resourceType":"product-drafts"}'

# 2. Check the summary after importing via API
commercetools import import-summaries get --container-key product-import

# 3. Inspect failed operations
commercetools import import-operations list \
  --container-key product-import \
  --limit 50 | jq '.results[] | select(.state=="rejected")'