Getting UID from a username in the API

There really needs to be a way to get the user ID of a player by giving the API their username. Most of the queries do not provide the user ID, so there is no way to get it.

1 Like

The query http://eterna.cmu.edu/get/?type=users&search=LFP6 will return it.  But it does return an array of (perhaps partial) matches, so you need to look through them to find an exact match.

The wiki documentation for the API says the query type is “user” rather than “users”, but that’s an error.

FWIW, I generally find the appropriate query by thinking where in the UI something similar is done (in this case, searching for a player by name) and then activating the browser’s debugger and looking at the query it performs.

Amazing, thank you!

By the way, type “user” is correct for pulling up information about a user when you have their UID. It looks like type users cannot do this.

Ah!  So they are two different query types. 

Since you are obviously interested in the API, I would love it if you added to the parameter and results documentation in the wiki as you find things out. I’ve been working on it slowly over time, in little chunks.

I was in fact actually planning to do that eventually. Would love to give a hand once I get some time to do so.

I know you’ve got a lot of things going right now.  But keep it in mind that it’s quicker to add a note to the Wiki when you find something out than it is to figure it out a second time, later.

If it’s a matter of something I can’t easily find, I will of course do that. However, the extent of my usage at this point is just calling up a query with an ID, and grabbing a particular subset of the data, which is something I would like to methodically replicate later.