The following procedure is for making massive user enrollment or registration, this guide comprises the use of the BioStar 2 API to recursively import user data using a CSV file and from there including Visual Face pre-enrollment data to the BioStar 2 users.
CSV Import:
This is the first step where you will be uploading the user data and the BioStar 2 API will create the users in BioStar 2.
API Call:
POST https://127.0.0.1:443/api/users/csv_import
Body request:
{ "File": { "uri": "1759346179121_uAsTh.csv", "type": "", "originalFileName": "User_20210318T222216.csv", "fileName": "1759346179121_uAsTh.csv" }, "CsvOption": { "columns": { "total": "30", "rows": [ "user_id", "name", "department", "user_title", "phone", "email", "user_group", "start_datetime", "expiry_datetime", "csn", "mobile_start_datetime", "mobile_expiry_datetime", "csn_mobile", "qr", "26 bit SIA Standard-H10301", "HID 37 bit-H10302", "HID 37 bit-H10304", "HID Corporate 1000", "HID Corporate 1000 48bit", "MIFARE CSN 32bit", "MIFARE CSN 34bit (Parity)", "DESFire 56bit", "DESFire 58bit (Parity)", "face_image_file1", "face_image_file2", "pin", "tom_aoc", "tom_scc" ] }, "start_line": 2, "import_option": 2 }, "Query": { "headers": [ "user_id", "name", "", "", "phone", "email", "user_group", "start_datetime", "expiry_datetime", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "face_image_file1", "face_image_file2", "", "", "" ], "columns": [ "user_id", "name", "department", "user_title", "phone", "email", "user_group", "start_datetime", "expiry_datetime", "csn", "mobile_start_datetime", "mobile_expiry_datetime", "csn_mobile", "qr", "26 bit SIA Standard-H10301", "HID 37 bit-H10302", "HID 37 bit-H10304", "HID Corporate 1000", "HID Corporate 1000 48bit", "MIFARE CSN 32bit", "MIFARE CSN 34bit (Parity)", "DESFire 56bit", "DESFire 58bit (Parity)", "face_image_file1", "face_image_file2", "pin", "tom_aoc", "tom_scc" ] }, "filterdUserIds": [], "Data": [ "5,Usuario Prueba 5,,,All Users,2025-01-25 00:00,2030-12-31 23:59,user05.jpg,", "6,Usuario Prueba 6,,,All Users,2025-01-25 00:00,2030-12-31 23:59,user06.jpg," ], "currentPhoneBook": 0 }
Expected response:
{ "Response": { "code": "0", "link": "https://support.supremainc.com/en/support/home", "message": "Success" } }
Once the first stage of importing the User data has finished, the second stage about including the facial data
Including Facial Data
Using the object relation between file names in the CSV file and user ids, you should loop (depending on your implementation) among all users, this step consists of two stages.
Stage A: Data conversion
User pictures are accessed one by one recursively using the order gotten from the CSV file, and convert the file into a Base64 object of the form:
API Call:
PUT https://127.0.0.1:443/api/users/check/upload_picture
Body request:
{ //this is the equivalent of the ‘user05.jpg’ and so on… "template_ex_picture": "/9j/4AAQSkZJRgABAQAAAQABAAD/4QBiRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAEAAAITAAMAAAABAAEAAAAAAAAAAAABAAAAAQAAAAEAAAAB/9sAQwAIB…. … //Z" }
Expected response:
{ "image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2w……..AAAA/Z", "image_template": "AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACLoYKTb4NhcmdvalKGdZNqlIF2dYuUaoeCcYCogYWFlI6Ck4pneISJg3yPbpJ2knVujod/………… bYOBcgAAAAAAAAAA", "image_template_2": "AAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB2Z39tjpaHi25zbXZrioR+……. Ej5B5cnRmhm9rgYx1k4d1kFCYgYaCiHtpZJKJhXl5cXmCkWF3hnyJeGh3a3mBgWqMeoVxcpaFeXCHggAAAAAAAAAA", "Response": { "code": "0", "link": "https://support.supremainc.com/en/support/home", "message": "Success" } }
Next Step,
Stage B: Data registration
Assign the facial data to the recently uploaded User data from the CSV file:
API Call
PUT https://127.0.0.1:8443/api/users/{user_id_from_CSV}
Body request:
{ "User": { "credentials": { "check_visualFace_img_validation": false, "visualFaces": [ { "flag": "1", "template_ex_normalized_image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wAARCABwAHADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIh ……", "templates": [ { "credential_bin_type": "5", "template_ex": "AAACAAAAAAAAAAAAAAAAAAAAAAAAAACb3NrZoVzeYd8bnR6nI1xhG5+cZSXiZqMiGx/got9h3F0gnOKkn18fYiSloB0XI….. ….iX9zbYOBcgAAAAAAAAAA" }, { "credential_bin_type": "9", "template_ex": "AAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAA………EiZV0ilyFh3uqiJWMgXyDcouIeoyKgnJabIlmdWqcin+OhIlmf4JvV3xzj6J5fYNeg35eaYKCfnmIbGqRe4B8goRslZRudHeOkFp8g3x2hH2FhHd2hHx/h4V/ " } ] } ] } } }
Conclusion
This process of Stages A and B should run for the whole list of your facial files included in the CSV file to complete the process.