How to resolve a steam custom vanity profile URL to steamID64

Viewed 1776

I am using Steam's API to fetch player data. To do this you need to provide a steamID64 (76561197960435530) like this example shown here: http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=440&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&steamid=76561197960435530 however this can sometimes be tricky for my users as many have their own custom vanity url which does not provide the steamID64 for them to easily input. I know they could use use a website to look it up but this is not an option.

How would I take the input of a custom vanity profile URL like this: https://steamcommunity.com/id/customNameHere and convert this programatically into a steamID64 like this: 76561197960435530

I would like to implement this using JavaScript or by using an API.

1 Answers

Found the solution. Here it says you can use the following syntax to resolve a vanity url:

http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=XXXXXXXXXXXXXXXXXXXXXXX&vanityurl=userVanityUrlName

Don't quite know why it was hiding on the TF2 wiki though...

Related