I’ll address all three critical aspects of your bulk import challenge:
CSV Template Requirements:
Your template needs strict adherence to the ICS 2021 pricing schema. Beyond the standard columns, ensure you’re including: PriceListID (mandatory foreign key), CurrencyCode (ISO 4217 format), UnitOfMeasure, and MinimumQuantity for tiered pricing. The template must have NO trailing commas, consistent delimiter usage (comma vs semicolon based on locale), and proper text qualifiers for fields containing special characters.
SKU,PriceListID,Price,CurrencyCode,EffectiveDate,CustomerSegment
PROD-001,PL-2024-Q1,125.50,USD,2024-03-01,WHOLESALE
PROD-002,PL-2024-Q1,89.99,USD,2024-03-01,RETAIL
Row-Level Error Logging:
Enable comprehensive logging through CloudSuite admin panel: System Configuration > Data Import > Advanced Settings. Set these parameters:
import.validation.mode=STRICT
import.error.detail.level=ROW
import.error.output.format=CSV
This generates a companion error file (filename_errors.csv) that maps each failed row to specific validation failures. The error file includes: RowNumber, FieldName, ErrorCode, ErrorMessage, and RejectedValue.
Rollback for Partial Imports:
The native import API doesn’t support transactional rollback across the entire file. Implement this two-phase approach:
- Pre-validation Phase: Submit your CSV to the validation-only endpoint before actual import:
POST /api/v1/pricing/import/validate
Content-Type: text/csv
This returns all validation errors without committing any data.
- Conditional Import: Only proceed with actual import if validation returns zero errors:
if (validationResponse.errorCount == 0) {
POST /api/v1/pricing/import/execute
}
- Backup Strategy: Before each import, export current pricing data as a rollback snapshot. If partial import occurs, you can restore from this backup.
For your specific 2,500-row scenario, I recommend batching at 250 rows per file with sequential naming (prices_batch_001.csv, prices_batch_002.csv, etc.). Process each batch through validation first, collect all error reports, fix issues across all batches, then execute imports sequentially. This approach gives you granular control and easier troubleshooting.
Alternatively, consider using the CloudSuite ION integration framework which provides built-in transaction management and automatic rollback capabilities for failed imports, though this requires additional configuration and BOD message mapping setup.