I want to use the speedrun.com api for a discord bot in JS but I can't get the players id by their nickname :
I use NodeJs and HTTPS for the request so when i make a request on https://speedrun.com/api/v1/users/Pseudo this doesn't return me a JSON file.
How can i get the ID by the pseudo to make my request ?
Sorry if there are mistakes.
I ran into the same problem.
You can use my unofficial API, but no guarentees as to the future of course.
https://sr-browser.dbeal.dev/api/v1/whatis/<username text>
When you use the request on https://www.speedrun.com/api/v1/users/Pseudo it does a redirect (status code 302) to a link with the ID, given by the "Location" response header. Then, the second request does return a json with the relevant ID in it.
Seems to me like it should work for you.
Thanks for your answers.
So I try with the "Location" response header but this doesn't give me a link with the ID but the same link (https://www.speedrun.com/api/v1/users/Pseudo).
Request: https://www.speedrun.com/api/v1/users/Stun
response header: { server: 'nginx/1.10.3', date: 'Wed, 11 Mar 2020 11:29:23 GMT', 'content-type': 'text/html', 'content-length': '187', connection: 'close', location: 'https://www.speedrun.com/api/v1/users/Stun' }
Hmm, very strange. I tried your link as well (by copying it and pasting to the browser), and it gave me a google search result. I then typed the entire link myself, and then it did work as intended.
That working link is: https://www.speedrun.com/api/v1/users/Stun
Now, since they are looking the same, I put the two links in a text-diff program and got different results (yours at the left contains some weird symbols):