Import/Export data
It is possible to import and export data from a device to synchronize between devices. You can export only user data, only access logs, perform synchronization, or do a full backup. It is also possible to import through all these options except for "access logs only". The import/export process can be performed through the device's web interface or GUI. These forms of synchronization are described below:
-
Users only: Export/Import only user data, fingerprints, and cards.
-
Only access logs: Export access logs only.
-
Synchronization: Export/Import all data contained in the device, except access logs. This option must be used to transfer data from one device to another.
-
Full backup: Export/Import all data contained in the device. This option must be used as a backup of data from the same device.
When exporting users, synchronization, or full backup, a zip file (users.zip, sync.zip, logs.zip) will be generated containing a folder named user_images and a corresponding CSV file. The user_images folder contains the images of registered users. The CSV file will be named users.csv if it is a user's data file, sync.csv if it is a sync file or backup.csv if it is a backup file. Exporting access logs generates a CSV file named logs.csv. Such zip files generated when exporting data from a device must be used in the corresponding import process on the target device.
Attention: It is very important to always update your device before exporting your sync files. There is no guarantee that a device with a newer firmware version will be able to import a sync file generated by a device with an older version.
In this way, to save the data of a device, you can export a backup file and, if the device has lost data, it is possible to use the file generated previously in the export to recover the data when importing it. The synchronization process, on the other hand, is more suitable for passing settings from one device to another, as access logs are not passed. Just export the sync file from the base device and have the target device import this file.
It is important to note that the export/import files (users.zip, sync.zip,logs.zip) must not be changed manually. Any non-compliance with the expected formatting may hamper the import process on the target device.
Export/import zip files have the same path structure and filenames for the V5 and V6 firmware line devices. However, the CSV files from the V6 line are different from the V5 line. Another difference is that on line V5, none of the users may have a photo, causing the user_images folder to be empty, which usually doesn't happen on line V6.
Synchronization
To generate an export .csv file, you need to use the export_objects endpoint.
POST /export_objects.fcgi
Parameters
- objects (array of JSON objects) : List of objects to be collected and included in the export file.
- object (string) : Type of object to be created. See the List of Objects topic for a complete list of available object types.
- columns (JSON object) : This field determines the columns that will be exported. The columns must be described together with the object, as in
{"object":"c_users","columns":["id","user_id","cpf"]}
.
Reply
Request example
Exporting data.
$.ajax({
url: "/export_objects.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"objects":[
{"object":"users"},
{"object":"cards","columns":["value","user_id"]},{"object":"user_roles"},
{"object":"c_users","columns":["id","user_id","cpf"]}
]
})
});