Job Commands
Commands for executing and monitoring jobs on B2C Commerce instances.
Authentication
Job commands require OAuth authentication with OCAPI permissions.
Required OCAPI Permissions
Configure these resources in Business Manager under Administration > Site Development > Open Commerce API Settings:
| Resource | Methods | Commands |
|---|---|---|
/jobs/*/executions | POST | job run |
/jobs/*/executions/* | GET | job run --wait, job wait |
/job_execution_search | POST | job search |
WebDAV Access
The job import and job export commands also require WebDAV access for file transfer.
Configuration
# OAuth credentials
export SFCC_CLIENT_ID=your-client-id
export SFCC_CLIENT_SECRET=your-client-secret
# WebDAV (for import/export)
export SFCC_USERNAME=your-bm-username
export SFCC_PASSWORD=your-webdav-access-keyFor complete setup instructions, see the Authentication Guide.
b2c job run
Execute a job on a B2C Commerce instance.
Usage
b2c job run JOBIDArguments
| Argument | Description | Required |
|---|---|---|
JOBID | Job ID to execute | Yes |
Flags
In addition to global flags:
| Flag | Description | Default |
|---|---|---|
--wait, -w | Wait for job to complete | false |
--timeout, -t | Timeout in seconds when waiting | No timeout |
--param, -P | Job parameter in format "name=value" (repeatable) | |
--body, -B | Raw JSON request body (for system jobs with non-standard schemas) | |
--no-wait-running | Do not wait for running job to finish before starting | false |
--show-log | Show job log on failure | true |
Note: --param and --body are mutually exclusive.
Examples
# 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 (standard jobs)
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 --jsonSystem Jobs with Custom Request Bodies
Some system jobs (like search indexing) use non-standard request schemas that don't follow the parameters array format. Use --body to provide a raw JSON request body:
# Run search index job for specific sites
b2c job run sfcc-search-index-product-full-update --wait --body '{"site_scope":["RefArch","SiteGenesis"]}'
# Run search index job for a single site
b2c job run sfcc-search-index-product-full-update --wait --body '{"site_scope":["RefArch"]}'b2c job wait
Wait for a job execution to complete.
Usage
b2c job wait JOBID EXECUTIONIDArguments
| Argument | Description | Required |
|---|---|---|
JOBID | Job ID | Yes |
EXECUTIONID | Execution ID to wait for | Yes |
Flags
In addition to global flags:
| Flag | Description | Default |
|---|---|---|
--timeout, -t | Timeout in seconds | No timeout |
--poll-interval | Polling interval in seconds | 3 |
--show-log | Show job log on failure | true |
Examples
# 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 5b2c job search
Search for job executions on a B2C Commerce instance.
Usage
b2c job searchFlags
In addition to global flags:
| Flag | Description | Default |
|---|---|---|
--job-id, -j | Filter by job ID | |
--status | Filter by status (comma-separated: RUNNING,PENDING,OK,ERROR) | |
--count, -n | Maximum number of results | 25 |
--start | Starting index for pagination | 0 |
--sort-by | Sort by field (start_time, end_time, job_id, status) | start_time |
--sort-order | Sort order (asc, desc) | desc |
Examples
# 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 --jsonOutput
The command displays a table of job executions with:
- Execution ID
- Job ID
- Status
- Start Time
b2c job import
Import a site archive to a B2C Commerce instance using the sfcc-site-archive-import system job.
Usage
b2c job import TARGETArguments
| Argument | Description | Required |
|---|---|---|
TARGET | Directory, zip file, or remote filename to import | Yes |
Flags
In addition to global flags:
| Flag | Description | Default |
|---|---|---|
--keep-archive, -k | Keep archive on instance after import | false |
--remote, -r | Target is a filename already on the instance (in Impex/src/instance/) | false |
--timeout, -t | Timeout in seconds | No timeout |
--show-log | Show job log on failure | true |
Examples
# 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 300Notes
- 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-archiveto retain)
b2c job export
Export a site archive from a B2C Commerce instance using the sfcc-site-archive-export system job.
Usage
b2c job exportFlags
In addition to global flags:
| Flag | Description | Default |
|---|---|---|
--output, -o | Output path for the export | . (current directory) |
--data-units | Data units JSON configuration | |
--site | Site ID(s) to export (comma-separated, repeatable) | |
--site-data | Site data types to export (comma-separated) | |
--global-data | Global data types to export (comma-separated) | |
--catalog | Catalog ID(s) to export (comma-separated) | |
--pricebook | Pricebook ID(s) to export (comma-separated) | |
--library | Library ID(s) to export (comma-separated) | |
--inventory | Inventory list ID(s) to export (comma-separated) | |
--keep-archive, -k | Keep archive on instance after download | false |
--no-download | Do not download archive (implies --keep-archive) | false |
--zip-only | Save as zip file without extracting | false |
--timeout, -t | Timeout in seconds | No timeout |
--show-log | Show job log on failure | true |
Examples
# 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 --jsonData 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 datacontent- Content assets and slotssite_preferences- Site preferencescampaigns_and_promotions- Marketing campaignscustomer_groups- Customer groupspayment_methods- Payment configurations- And more (see OCAPI documentation)
Global Data Types
When using --global-data, available types include:
all- Export all global datameta_data- System and custom object metadatacustom_types- Custom object type definitionspreferences- Global preferenceslocales- Locale configurationsservices- Service configurations- And more (see OCAPI documentation)