Overview
DAL’s bulk import API allows you to efficiently migrate large datasets while maintaining data integrity and system performance. This guide covers:- Batch Processing: How to handle importing large datasets efficiently.
- Data Validation: Ensuring data quality before import.
- Error Handling: Robust retry mechanisms and failure recovery.
- Performance Optimization: Best practices for optimal throughput when integrating with Dal.
Prerequisites
Before starting your migration, ensure you have:- API Credentials: Contact your DAL administrator for API key and tenant information.
- Data Access: Access to your source data (CSV, database, etc.).
- Network Connectivity: Stable connection to DAL’s API endpoints.
What We Expect From You
The migration process involves making HTTP calls to DAL’s bulk client endpoint. Your client data should be prepared and sent in batches to this endpoint. Once received, DAL’s backend system will process these batches, validate the data, and reflect the imported clients in the web portal for your compliance team’s review and management. To facilitate this, your development team should implement a dedicated service layer or a migration script that extracts data from your existing database and transforms it into the required format before sending it to DAL via HTTP requests.Migration Examples
Python Implementation
Required Python Packages
Configuration
API Endpoints
Authentication Headers
Batch Configuration
Duplicate Modes
Choose how to handle existing clients during migration:Skip: Skip existing clients (recommended for migrations).Update: Update existing clients with new data.
Data Mapping
Client Fields
Fields:nameEn- Name in English (string)nameAr- Name in Arabic (string)type- Entity type (Individual/Organization)email- Email addressaccountOpenDate- Account opening date (ISO format)dobGregorian- Date of birth (ISO format)dateOfIncorporationGregorian- Incorporation date (ISO format)nationalityCode- ISO 3166-1 alpha-2 country codestatus- Client statusidentities- Array of identities with a minimum size of 1
Note: For the complete request payload structure and field specifications, refer to the Bulk Insertion API Endpoint documentation.
Nationality Mapping
Map your nationality values to ISO 3166-1 alpha-2 codes:Data Validation
Date Format Conversion
Convert dates to ISO format (YYYY-MM-DD):Client Validation
Batch Processing
Reading Data in Batches
Data Mapping Function
Error Handling and Retries
Robust Batch Sending
Complete Migration Script (Python Example, Typescript Example Is Provided In The Next Section)
Best Practices When Implementing Your Own Migrator Service/Script
1. Error Handling
- Implement comprehensive retry logic
- Log all failures for debugging
- Validate data before sending
- Handle network timeouts gracefully
- Keep track of batches to retry failed ones later
2. Performance Monitoring
- Track processing time per batch
- Log progress regularly
- Set up alerts/logs for failures
3. Data Quality
- Validate required fields before sending
- Clean and normalize data
- Handle missing or invalid dates
- Map nationalities correctly
Troubleshooting
Common Issues
- Authentication Errors: Verify API key and tenant name
- Validation Failures: Check required fields and data formats
- Timeout Errors: Reduce batch size or increase timeout
- Memory Issues: Process data in smaller batches
Debug Mode
Enable detailed logging for troubleshooting:Post-Migration
Case Generation
After completing client migration, log into the portal to review historical data case matching results.Verification
Verify your migration by:- Checking client counts in DAL dashboard
- Validating sample records
- Testing case generation
- Reviewing audit logs
Support
For migration assistance:- Review this guide thoroughly
- Test with small datasets first and keep track of your batch successes and failures
- Contact your DAL administrator or development team for support via the dedicated Slack channel
API Reference
Bulk Import Endpoint
POST/services/crm/clients/bulk
Import multiple clients in a single request.
Headers:
x-api-key: Your API keyx-tenant: Your tenant nameContent-Type: application/json
TypeScript Implementation
For Node.js environments, here’s a TypeScript implementation:Required Packages
Migration Script (TypeScript Example)
Key Differences from Python
- Type Safety: Full TypeScript types for better development experience.
- Async/Await: Native promise handling.
- Streaming: Efficient data processing with streams.
- Error Handling: Structured error handling with try/catch.