Skip to content

Job Commands

Commands for executing and monitoring jobs on B2C Commerce instances.

b2c job run

Execute a job on a B2C Commerce instance.

Usage

bash
b2c job run JOBID

Arguments

ArgumentDescriptionRequired
JOBIDJob ID to executeYes

Flags

In addition to global flags:

FlagDescriptionDefault
--wait, -wWait for job to completefalse
--timeout, -tTimeout in seconds when waitingNo timeout
--param, -PJob parameter in format "name=value" (repeatable)
--no-wait-runningDo not wait for running job to finish before startingfalse
--show-logShow job log on failuretrue

Examples

bash
# Execute a job
b2c job run my-custom-job

# Execute and wait for completion
b2c job run my-custom-job --wait

# Execute with timeout
b2c job run my-custom-job --wait --timeout 600

# Execute with parameters
b2c job run my-custom-job -P "SiteScope={\"all_storefront_sites\":true}" -P OtherParam=value

# Output as JSON
b2c job run my-custom-job --wait --json

Authentication

This command requires OAuth authentication with OCAPI permissions for the /jobs resource.


b2c job wait

Wait for a job execution to complete.

Usage

bash
b2c job wait JOBID EXECUTIONID

Arguments

ArgumentDescriptionRequired
JOBIDJob IDYes
EXECUTIONIDExecution ID to wait forYes

Flags

In addition to global flags:

FlagDescriptionDefault
--timeout, -tTimeout in secondsNo timeout
--poll-intervalPolling interval in seconds3
--show-logShow job log on failuretrue

Examples

bash
# Wait for a job execution
b2c job wait my-job abc123-def456

# Wait with timeout
b2c job wait my-job abc123-def456 --timeout 600

# Wait with custom polling interval
b2c job wait my-job abc123-def456 --poll-interval 5

Authentication

This command requires OAuth authentication with OCAPI permissions for the /jobs resource.


Search for job executions on a B2C Commerce instance.

Usage

bash
b2c job search

Flags

In addition to global flags:

FlagDescriptionDefault
--job-id, -jFilter by job ID
--statusFilter by status (comma-separated: RUNNING,PENDING,OK,ERROR)
--count, -nMaximum number of results25
--startStarting index for pagination0
--sort-bySort by field (start_time, end_time, job_id, status)start_time
--sort-orderSort order (asc, desc)desc

Examples

bash
# Search all recent job executions
b2c job search

# Search for a specific job
b2c job search --job-id my-custom-job

# Search for running or pending jobs
b2c job search --status RUNNING,PENDING

# Get more results
b2c job search --count 50

# Output as JSON
b2c job search --json

Output

The command displays a table of job executions with:

  • Execution ID
  • Job ID
  • Status
  • Start Time

Authentication

This command requires OAuth authentication with OCAPI permissions for the /job_execution_search resource.


b2c job import

Import a site archive to a B2C Commerce instance using the sfcc-site-archive-import system job.

Usage

bash
b2c job import TARGET

Arguments

ArgumentDescriptionRequired
TARGETDirectory, zip file, or remote filename to importYes

Flags

In addition to global flags:

FlagDescriptionDefault
--keep-archive, -kKeep archive on instance after importfalse
--remote, -rTarget is a filename already on the instance (in Impex/src/instance/)false
--timeout, -tTimeout in secondsNo timeout
--show-logShow job log on failuretrue

Examples

bash
# Import from a local directory (will be zipped automatically)
b2c job import ./my-site-data

# Import from a zip file
b2c job import ./export.zip

# Keep archive on instance after import
b2c job import ./my-site-data --keep-archive

# Import from existing file on instance
b2c job import existing-archive.zip --remote

# With timeout
b2c job import ./my-site-data --timeout 300

Notes

  • When importing a directory, it will be automatically zipped before upload
  • The archive is uploaded to Impex/src/instance/ on the instance
  • By default, the archive is deleted after successful import (use --keep-archive to retain)

Authentication

This command requires OAuth authentication with OCAPI permissions for the /jobs resource and WebDAV access for file upload.


b2c job export

Export a site archive from a B2C Commerce instance using the sfcc-site-archive-export system job.

Usage

bash
b2c job export

Flags

In addition to global flags:

FlagDescriptionDefault
--output, -oOutput path for the export. (current directory)
--data-unitsData units JSON configuration
--siteSite ID(s) to export (comma-separated, repeatable)
--site-dataSite data types to export (comma-separated)
--global-dataGlobal data types to export (comma-separated)
--catalogCatalog ID(s) to export (comma-separated)
--pricebookPricebook ID(s) to export (comma-separated)
--libraryLibrary ID(s) to export (comma-separated)
--inventoryInventory list ID(s) to export (comma-separated)
--keep-archive, -kKeep archive on instance after downloadfalse
--no-downloadDo not download archive (implies --keep-archive)false
--zip-onlySave as zip file without extractingfalse
--timeout, -tTimeout in secondsNo timeout
--show-logShow job log on failuretrue

Examples

bash
# Export global metadata
b2c job export --global-data meta_data

# Export a site's content and preferences
b2c job export --site RefArch --site-data content,site_preferences

# Export catalogs
b2c job export --catalog storefront-catalog

# Export with custom data units JSON
b2c job export --data-units '{"global_data":{"meta_data":true}}'

# Export to a specific directory
b2c job export --output ./exports

# Keep archive on instance
b2c job export --global-data meta_data --keep-archive

# Output as JSON
b2c job export --global-data meta_data --json

Data Units

The export is configured using "data units" which specify what data to export. You can use convenience flags (--site, --global-data, etc.) or provide a full JSON configuration with --data-units.

Site Data Types

When using --site-data, available types include:

  • all - Export all site data
  • content - Content assets and slots
  • site_preferences - Site preferences
  • campaigns_and_promotions - Marketing campaigns
  • customer_groups - Customer groups
  • payment_methods - Payment configurations
  • And more (see OCAPI documentation)

Global Data Types

When using --global-data, available types include:

  • all - Export all global data
  • meta_data - System and custom object metadata
  • custom_types - Custom object type definitions
  • preferences - Global preferences
  • locales - Locale configurations
  • services - Service configurations
  • And more (see OCAPI documentation)

Authentication

This command requires OAuth authentication with OCAPI permissions for the /jobs resource and WebDAV access for file download.

All rights reserved.