How to Import Dictionary CSV
This document explains how to import a dictionary CSV file, including the upload step and the import confirmation request.
How it works
Step 1. Upload the CSV file
input.addEventListener("change", function (e) {
var file = e.target.files[0];
new tus.Upload(file, {
endpoint: "http://localhost:8080/api/v1/upload/dictionary-large",
retryDelays: [0, 3000, 5000, 10000, 20000],
metadata: {
filename: file.name,
filetype: file.type
},
headers: {
Dictionary: dictionaryUuid,
Mailbox: mailboxUuid,
Authorization: "Bearer ..."
},
onError: function (error) {
console.log("Failed because: " + error);
},
onProgress: function (bytesUploaded, bytesTotal) {
var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2);
console.log(bytesUploaded, bytesTotal, percentage + "%");
},
onSuccess: function () {
console.log("Download %s from %s", upload.file.name, upload.url);
},
onAfterResponse: async (req, res) => {
if (res.getHeader("Task")) {
taskUuid = res.getHeader("Task");
}
}
}).start();
});Step 2. Confirm the import task
CSV requirements
Related topics
Last updated
Was this helpful?
