--- name: b2c-site-import-export description: Work with site archive structure and metadata XML patterns. Use when adding custom attributes, system object extensions, site preferences, or understanding import/export XML schemas. Covers directory structure and XML file formats for site archives. --- # Site Import/Export Skill Use the `b2c` CLI plugin to import and export site archives on Salesforce B2C Commerce instances. ## Import Commands ### Import Local Directory ```bash # Import a local directory as a site archive b2c job import ./my-site-data # Import and wait for completion b2c job import ./my-site-data --wait # Import a local zip file b2c job import ./export.zip # Keep the archive on the instance after import b2c job import ./my-site-data --keep-archive # Show job log if the import fails b2c job import ./my-site-data --wait --show-log ``` ### Import Remote Archive ```bash # Import an archive that already exists on the instance (in Impex/src/instance/) b2c job import existing-archive.zip --remote ``` ## Export Commands ```bash # Export site data b2c job export # Export with specific configuration b2c job export --wait ``` ## Common Workflows ### Adding a Custom Attribute to Products 1. Create the metadata XML file: **meta/system-objecttype-extensions.xml:** ```xml Vendor SKU string false true Custom Attributes ``` 2. Create the directory structure: ``` my-import/ └── meta/ └── system-objecttype-extensions.xml ``` 3. Import: ```bash b2c job import ./my-import --wait ``` ### Adding Site Preferences 1. Create metadata for the preference: **meta/system-objecttype-extensions.xml:** ```xml Enable Feature X boolean false ``` 2. Create preference values: **sites/MySite/preferences.xml:** ```xml true ``` 3. Directory structure: ``` my-import/ ├── meta/ │ └── system-objecttype-extensions.xml └── sites/ └── MySite/ └── preferences.xml ``` 4. Import: ```bash b2c job import ./my-import --wait ``` ### Creating a Custom Object Type 1. Define the custom object: **meta/custom-objecttype-definitions.xml:** ```xml API Configuration source-to-target site Config ID string 1 API Endpoint string API Key password Active boolean true ``` 2. Import: ```bash b2c job import ./my-import --wait ``` ### Importing Custom Object Data **customobjects/APIConfiguration.xml:** ```xml https://api.payment.com/v2 true ``` ## Site Archive Structure ``` site-archive/ ├── services.xml # Service configurations (credentials, profiles, services) ├── meta/ │ ├── system-objecttype-extensions.xml # Custom attributes on system objects │ └── custom-objecttype-definitions.xml # Custom object type definitions ├── sites/ │ └── {SiteID}/ │ ├── preferences.xml # Site preference values │ └── library/ │ └── content/ │ └── content.xml # Content assets ├── catalogs/ │ └── {CatalogID}/ │ └── catalog.xml # Products and categories ├── pricebooks/ │ └── {PriceBookID}/ │ └── pricebook.xml # Price definitions ├── customobjects/ │ └── {ObjectTypeID}.xml # Custom object instances └── inventory-lists/ └── {InventoryListID}/ └── inventory.xml # Inventory records ``` ## Tips ### Checking Job Status ```bash # Search for recent job executions b2c job search # Wait for a specific job execution b2c job wait # View job logs on failure b2c job import ./my-data --wait --show-log ``` ### Best Practices 1. **Test imports on sandbox first** before importing to staging/production 2. **Use `--wait`** to ensure import completes before continuing 3. **Use `--show-log`** to debug failed imports 4. **Keep archives organized** by feature or change type 5. **Version control your metadata** XML files ### Configuring External Services For service configurations (HTTP, FTP, SOAP services), see the `b2c:b2c-webservices` skill which includes: - Complete services.xml examples - Credential, profile, and service element patterns - Import/export workflows Quick example: ```bash # Import service configuration b2c job import ./services-folder ``` Where `services-folder/services.xml` follows the patterns in the `b2c:b2c-webservices` skill. ## Detailed Reference - [Metadata XML Patterns](references/METADATA-XML.md) - Common XML patterns for imports ## Related Skills - `b2c:b2c-webservices` - Service configurations (HTTP, FTP, SOAP), services.xml format - `b2c:b2c-metadata` - System object extensions and custom object definitions - `b2c-cli:b2c-job` - Running jobs and monitoring import status