Converting a soundcloud username to userid

1.2k views Asked by At

I want to embed the soundcloud widget (ex: http://www.sabbatella.com/soundcloud.htm) of lots of users in their profiles. I have all their usernames but not the user ids, which are necessary to embed the code.

Could you please explain me how to convert a soundcloud username to its userid in the most simple way? Ex: http://www.soundcloud.com/nightclubber is user id 32661578.

1

There are 1 answers

1
nickf On

You don't actually need the user id. Embed the player with the user's profile page as the url parameter and it will automatically be resolved when the player starts. It will mean one additional ajax request before the player loads, but it's probably not too bad.

For example, these two are equivalent:

https://w.soundcloud.com/player/?url=https%3A//soundcloud.com/spadgos
https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/users/6431392

Alternatively, you can use the resolve endpoint to resolve a permalink to a user

https://api.soundcloud.com/resolve?url=https%3A//soundcloud.com/spadgos&client_id=YOUR_CLIENT_ID