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.
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.
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.
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
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 http://data.stackexchange.com/stackoverflow/queries is your Stack Overflow user ID, while in http://data.stackexchange.com/english/queries you should use your EL&U user ID.