Script to retrieve the user list with first name and last, email, and userID
const INSTANCE_URL = 'https://example.sisense.com/'; // Example
$.ajax({
url: `${INSTANCE_URL}/api/v1/users`,
method: 'GET',
success: (users) => {
const allUsers = users.map((user) => {
return {
email: user.email,
_id: user._id,
firstName: user.firstName,
lastName: user.lastName,
lastActivity: user.lastActivity,
};
});
console.table(allUsers);
const csvData = allUsers.map((user) => Object.values(user).join(',')).join('\n');
const filename = 'all_users.csv';
const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
if (navigator.msSaveBlob) {
navigator.msSaveBlob(blob, filename);
} else {
const link = document.createElement('a');
if (link.download !== undefined) {
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', filename);
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
}
}
},
error: (xhr, status, error) => {
console.error(`AJAX request failed: ${error}`);
},
});
Disclaimer: This blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their environment before deploying them to ensure that the solutions proffered function as desired. To avoid doubt, the content of this blog post is provided to you "as-is" and without warranty of any kind, express, implied, or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding, which is outside the Sisense product development environment and is, therefore, not covered by Sisense warranty and support services.