Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Hue retrieve user list with curl/Python in Hue 4.x

Contributor

Hi,

 

I posted previously about how to delete a Hue user using curl or Python.  What I needed was the exact URL to use along with the form data that should be used.  I figured that part out.  However, it appears that Hue uses the internal ID to delete users and the user name, which I believe is like the unique ID of the user, is all that is known.  So, somehow, I need to take the user name and find it's corresponding internal ID.

I started down the path of loading the user list in the page after authentication and loading the DOM up with the data I needed.  I drilled down the DOM and was able to get the internal ID on an older version of Hue.

However, in working with a newer version of Hue, I realize that they use Javascript to load the user list into an div container.  Our current version of Hue is 4.x and I believe I was working in 3.x when I first figured out how to load the list and drill down the DOM to get the internal ID.

So, in the old Hue, I could use this URL from Python: 

https://<host>:<port>/useradmin/users/'

 and it would load the user list.  I could proceed with drilling the DOM and find the internal ID for the user I want to delete.

However, in the new Hue, if I use this URL from Python:

https://<host>:<port>/hue/useradmin/users'

 it does not load the user list as it is Javascript controlled.  Note the "/hue/" part of the path.

Fortunately, I found that in the new version of Hue, I could call the first URL/URI and it would load the list of users.  However, at the top of the window in the web browser, Hue popped up a notification indicating I was using an older version that looked like this:

This buys me some time but I would assume the developers of Hue will eventually depracate the "/useradmin/users/" option and therefore render my code useless.

Bottom line is, I have to figure out how to load the user list in code just as the web browser does by executing Javascript or make some kind of call that will retrieve the user list with the current and future version of Hue.

BTW, I can't get access to the server so I need to do this through web browser calls.

 

Thanks!

2 REPLIES 2

Master Collaborator
Yes, please Cloudera, make some effort to publish a documented Python/REST API for Hue access management (create/drop user, create/drop group, sync groups)

Contributor

BTW, I should have made this request in my previous post.  Please DO NOT remove the /useradmin/users/ URL option until you have come up with an API or an easier way to scrape the web pages.  Being that the message indicates that is the old way of getting the list of users and the new way is using Javascript to load it, if you remove the old way and we upgrade, using the old URL won't allow me to load the user list.

So, can someone there make a note to not remove that old URL please!!!

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.