A Node.js utility to import CSV data (users, organizations, and licenses) into Cryptlex.
- Imports data from CSV files
- Creates users, organizations, and licenses based on CSV content
- Handles duplicate checks for organizations
- Supports metadata for licenses
- Logs operations to a file
- Node.js installed
- Access token for API authentication
- CSV files with an appropriate data structure
- Must include:
- name
- allowedUsers
- Must include:
- firstName
- lastName
- Must include:
- key
- Optional:
- allowedActivations
- expiresAt
- createdAt
- subscriptionInterval
- order_id (will be added as metadata)
- firstName (user details)
- lastName
- Configure the following variables :
ACCESS_TOKEN: Your Cryptlex API access tokenAPI_BASE_URL: The Cryptlex API base URLPRODUCT_ID: The ID of the product to associate licenses withCSV_FILE_PATH: The path to the CSV file with the data. The file name should begin with organization or license, or user.
- Prepare your CSV file with the required fields
- npm i
- Run the importer:
node main.js
The script will automatically detect the type of resource to create based on the CSV filename:
- Files starting with 'organization' will create organizations
- Files starting with 'user' will create users
- All other files will be treated as license imports
Operations are logged to a file for tracking and debugging purposes.