Errors with uploadCSV (V3 Issue)

Hi Support Team,

Our team has encountered an issue with the “uploadCSV” adapter function for creating multiple users from the V3 library. We get an error which states, “Unknown user upload content type(text/plain)”.

Additionally, the documentation doesn’t mention if specific headers are needed in the CSV file (similar to the template provided on interface builder simulations) as well as if there are parameters that must be passed to the function. Could either of those points be the reason for the error?

Below is a code snippet of how we intended to use it, which is to call it from the userAdapter and pass the file which is a path to the directory of the CSV file.

upload-users

Any guidance on how we can resolve this issue would be appreciated.

Kind Regards,
Vishan De Silva

Hi,

One of my colleagues who has used this API reports the following:

userAdapter.uploadCSV expects to be called with an instance of the File interface MDN. If called with a string representing the path to a file, the method will not work as expected.

This means there are a few prior steps to get a File instance from a path. The exact procedure will depend on the environment, but if you are fetching a resource in the browser, you can do something like this:

const response = await fetch('path/to/file.csv');
const blob = await response.blob();
const file = new File([blob], 'file.csv', { type: 'text/csv' });
userAdapter.uploadCSV(file);

That will address the error Unknown user upload content type(text/plain).

Headers are required for the CSV file. Valid headers are:

  • Email
  • Handle
  • Given Name
  • Family Name
  • Password
  • Display Name