Not sure if this is the correct answer, but it seems that destinytracker uses a dash instead of hashtag.
http://destinytracker.com/d2/profile/pc/Zyenax-1565
English
-
Editado por Varix: 11/10/2017 6:08:43 AM[quote]Not sure if this is the correct answer, but it seems that destinytracker uses a dash instead of hashtag. [url=http://destinytracker.com/d2/profile/pc/Zyenax-1565]http://destinytracker.com/d2/profile/pc/Zyenax-1565[/url][/quote] Ok so first, I tried the dash part which would be: [quote]destiny2.getProfile('Zyenax-1565', '3').then(data => console.log(data));[/quote] and that returned this error: [quote](node:12824) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property '0' of undefined[/quote] I also tried making my own method: [quote] request('https://www.bungie.net/Platform/Destiny2/SearchDestinyPlayer/-1/xxjoediertayxx', {headers: {'X-API-Key': apikey}}, (error, response, body)=> { if (!error && response.statusCode === 200) { const d2profile = JSON.parse(body) console.log(chalk.red(body)); console.log(d2profile); request('https://www.bungie.net/Platform/Destiny2/1/profile/' + d2profile.Response[0].membershipId + '/?components=Profiles,Characters', {headers: {'X-API-Key': apikey}}, (error, response, body)=> { if (!error && response.statusCode === 200) { const d2profile = JSON.parse(body) console.log(chalk.cyan(body)); console.log(d2profile); } else { console.log(error) } }) } else { console.log(error) } }) [/quote] and this worked for an Xbox 1 players stats. So it seems that i can retrieve xbox and ps4 players stats just not any pc ones. If you could help search a bit more on what the sign could be instead of the battle tag's deafult # that could help.
-
https://github.com/Bungie-net/api/issues/258 [quote]Try altering that URL from 'Zyenax#1565' to 'Zyenax%231565'. URL fragments use the reserved symbol '#', so everything after the # is not sent to the server, likely causing problems for you.[/quote]
-
How would i get it to work though if i want them to enter their name with their battle tag how could i convert it or find what their bungie id is
-
Take user input, call API with input, parse the payload for whatever you need. https://github.com/Bungie-net/api
-
Also how did you get that number at the end.
-
If you're referring to [quote]%231565[/quote] ASCII code for # is %23 https://www.w3schools.com/charsets/ref_html_ascii.asp
-
That worked thank you.