I'm in the data explorer, and I need my user ID for a query. Problem is, I don't know what it is, if it's not my username.
-
2Your profile view, meta.stackoverflow.com/users/164012/drm65 - I would think your id is the "164012" segment (on meta).– user159834Jul 16, 2011 at 16:47
-
I am specifically asking about my ELU account: http://english.stackexchange.com/users/10041/drm65 I would think the same thing (10041), except the query doesn't come up with any results when I input 10041 into here– DanielJul 16, 2011 at 16:50
-
4The data explorer is updated with live data only once per month, usually the first of the month. Perhaps you have to wait a few days to see the desired data.– user138231Jul 16, 2011 at 17:36
-
4Note that it is different for different sites. A lot of people are suggesting your Meta.SO account, which is all fine and good, but if you want ELU or SO, you need to check those IDs on the user page for that particular site.– Cody Gray - on strikeJul 17, 2011 at 4:45
-
5You are number 6.– RosinanteNov 5, 2011 at 23:26
-
+1 @Rosinante. I'm surprised that nobody ever +1 that until now. (But does that make you number 1, at least for the moment)?– CoolHandLouisJun 19, 2014 at 4:07
5 Answers
You can find it in several ways.
- The link from your flair on the question contains your id - https://meta.stackexchange.com/users/164012/daniel - in this case it's 164012 here on meta.
- Go to your profile page and select the accounts tab. The list of sites links to your profile on that site. So for EL&U the link is https://english.stackexchange.com/users/10041/, so your user id there is 10041.
Your id is different on each site as it depends on when you joined the site and how many people had joined before you. This means that if you just change the site name in the profile url you won't get your account on that site, you'll almost certainly get someone else's. The only exception to this is this site for those users who existing on Stack Overflow when Meta was first created. In that instance Jeff just copied the user table so we have the same id.
There is also your network id - https://stackexchange.com/users/429575/daniel - in your case.
-
1
-
2@drm65 - I don't know. That is your profile. How long have you been a member of EL&U? The data explorer data is always at least one month out of date. So if you're less than a month on the site you won't appear just yet.– ChrisF ModJul 16, 2011 at 17:00
-
1@drm65 ChrisF is correct. That query works for other userIDs whose owner joined earlier than you.– BillJul 16, 2011 at 17:05
-
1
-
The 2nd way doesn't work anymore. Can you confirm and update your answer ?– SuhaibJul 21, 2014 at 22:48
You can find your user ID for a particular Stack Exchange site by performing the following steps:
First, visit your user profile on the site in question.
Take a close look at the URL for your profile page:
You should spot a number right after the
users/
and before the slug for your username. This is your user ID for that site.
-
3
-
2@MichaelMrozek: Actually, to be honest, I'm writing a PHP library for the API and I needed a single answer somewhere that clearly described how to retrieve a user's ID. None of the other answers seemed to do that. Nov 5, 2011 at 20:40
-
Your user ID is 164012. You can find it in the url of your user page: https://meta.stackoverflow.com/users/164012/drm65
Get all stackexchange user ids for a user
Find your user-ID of your Network Profile in your user section, then you can get all other IDs with this bash script:
ID=429575
USER=daniel
curl https://stackexchange.com/users/$ID/$USER?tab=accounts|grep account-container -A1|grep http|cut -d"/" -f3,5
This will give you a list of all SE-sites and user-ids.
If you need a list of all questions and answers:
#/bin/bash
SE_ID=429575
U=daniel
users=$(curl https://stackexchange.com/users/$SE_ID/$U?tab=accounts|grep account-container -A1|grep http|cut -d"/" -f3,5|xargs)
for i in $users; do
site=$(echo $i|sed "s~/.*$~~g")
id=$(echo $i|sed "s~^.*/~~g")
for a in questions answers; do
URL=http://$site/users/$id/$U?tab=$a
echo $URL
done
done
-
-
1if you don't want to parse you can use SEDE : data.stackexchange.com/askubuntu/query/1259066?UserId=34298– reneJul 5, 2020 at 14:40
Your user ID is different on each SE site; in the list of user profiles listed, for example, in https://meta.stackoverflow.com/users/164012/drm65?tab=accounts, the user ID is always the number after users/.
The one you need to use depends on where you are executing the query: The one that you need to use in https://data.stackexchange.com/stackoverflow/queries is your Stack Overflow user ID, while in https://data.stackexchange.com/english/queries you should use your EL&U user ID.