BillV Posted November 29, 2023 Posted November 29, 2023 Hi Is there a way to export my user list to an excel file? I'm on v58. Thanks Bill V
Thorsten Vogt Posted December 1, 2023 Posted December 1, 2023 Hello Bill, one way I can think of is using a little python script inside Seeq Data Lab: import seeq.sdk as sdk import pandas as pd user_api = sdk.UsersApi(spy.client) userlist = user_api.get_users() users = list() for user in userlist.users: users.append({"Username": user.username, "First Name": user.first_name, "Last Name": user.last_name, "Directory": user.datasource_name}) pd.DataFrame(users).to_excel("userlist.xlsx") You might need to run pip install openpyxl first and restart the kernel, if you get an error message that the package could not be found. The Excel file will appear in the rootfolder of your DataLab project and can be downloaded from there. I tested the script on R61, so I am not sure if you need to modify it a bit to get it working with R58. Regards, Thorsten
BillV Posted December 13, 2023 Author Posted December 13, 2023 @Thorsten Vogt Thanks for the response! Unfortunately, we don't have Data lab running yet.
Thorsten Vogt Posted December 13, 2023 Posted December 13, 2023 Hello Bill, if you do not have Data Lab than you can use the REST API of Seeq. I created an example using Powershell: $baseurl = "https://myseeqinstance" $headers = @{ "accept" = "application/vnd.seeq.v1+json" "Content-Type" = "application/vnd.seeq.v1+json" } $body = @{ "authProviderClass" = "Auth" "authProviderId" = "Seeq" "code" = $null "password" = "<password>" "state" = $null "username" = "<username>" } | ConvertTo-Json $url = $baseurl + "/api/auth/login" $response = Invoke-WebRequest -Method Post -Uri $url -Headers $headers -body $body $headers = @{ "accept" = "application/vnd.seeq.v1+json" "x-sq-auth" = $response.Headers.'x-sq-auth' } $url = $baseurl + "/api/users?sortOrder=email%20asc&offset=0&limit=200" $response = Invoke-RestMethod -Method Get -Uri $url -Headers $headers $selectedAttributes = $response.users | Select-Object -Property firstname, lastname, email $selectedAttributes | Export-Csv -Path "userlist.csv" -NoTypeInformation The script uses the /auth/login endpoint to authenticate the user and retrieves the list of users (limited to 200) using the /users endpoint. You would need to replace the value in the first line with the URL of your Seeq system (eg. https://mycompany.seeq.site) and specify the credentials by replacing <password> and <username> inside the script. The list of users will be written to the file userlist.csv inside the directory from which the powershell script is run. Let me know if this works for you. Regards, Thorsten 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now