Closed kyran123 closed 6 years ago
If you put a log statement in your code like so
const paladins = hirez.paladins('PC')
paladins.session.generate().then((res) => {
paladins.getMatchHistory('Kyran123').then((MatchResult) => {
for (let i = 0; i < MatchResult.length; i++) {
paladins.getMatchDetails(MatchResult[i].Match).then((MatchDetailsResult) => {
for (let j = 0; j < MatchDetailsResult.length; j++) {
console.log(MatchDetailsResult[i])
}
}).catch((err) => {
console.log('Error occurred match details: ' + err);
});
}
}).catch((err) => {
console.log('Error occurred match id: ' + err);
});
}).catch((err) => {
console.log('Error occurred session: ' + err);
});
What you end up seeing is that some of the match details are being returned while some of them are returning "undefined". I looked over on the HiRez API group on podio and I found a post by HiRezAaron posted yesterday.
ATTENTION PALADINS API DEVELOPERS: Later today I'll be making changes to the getMatchDetails() and playerMatchHistory() endpoints such that competitive players will no longer have their match details returned. If the map_game field contains the string "Ranked" it won't be returned. This is in response to complaints that exposing this data "compromises the competitive integrity for our professional players as they prepare for our competitive league games and tournaments".
After looking at the match history that is returned, it seems that some are ranked games. So this is where your problem is coming from.
I appreciate you filing the issue and asking the question! Feel free to open any issues to report an issue, ask a question, or request a feature in the future!
I apologize, I found a mistake in my code above. Just had a new baby recently, so I'm a bit of a zombie right now. But changing the
console.log(MatchDetailsResult[i])
to
console.log(MatchDetailsResult[j])
results in all of the match history for the corresponding match id's to be displayed.
Try again and let me know if you're still having the issue. If you are, we will investigate further. It's working fine on my end.
I appreciate your quick response! I have been keeping up with the Podio group and what has been going on. I've been having this issue for the last 3 days however. it's not relevant to that update, since even this code:
const Hirez = require('hirez.js');
let hirez = new Hirez({
devId: '',
authKey: ''
});
const paladins = hirez.paladins('PC');
paladins.session.generate().then((res) => {
paladins.ping().then(console.log).catch(console.log);
paladins.getDataUsed().then(console.log).catch(console.log);
}).catch((err) => {
console.log('Error occurred session: ' + err);
});
results in an unhandled promise rejection.
Your above code works fine for me. I created a new blank project. Installed hirez.js via npm, put my devId and authkey into a json file (so i could run the code and take this screenshot), pasted your code in and ran it. It came back ok for me. Are you at the request limit for your key for the day? You can only make 7500 requests per day, with 50 concurrent sessions, with a cap of 500 session.
Also I'm running node.js v8.9.1 and npm v5.6.0.
Maybe it has to do with the version of node you're running? Let me know what you got.
I installed node and the package like a week ago, so I can't imagine it being the cause. NPM version is 5.6.0. I can safely say I'm not exceeding any of these limits. I've only used about 20 sessions this entire day. and requests... well it crashes on the first one.
Its looks like node.js is having an issue connecting to the ip address for the paladins api server. Its resolving the domain name (api.paladins.com) to an ip, but then its having an issue connecting to the api server at that ip address. In the phpstorm terminal can you ping api.paladins.com? Also try opening a web browser and going to http://api.paladins.com/paladinsapi.svc/pingjson to see if you get a response.
You are right. I pinged api.paladins.com and all packages were lost... I guess it's something on their side? I'll send a message to Aaron on Podio and see if he can help me further. If you want I can report back once I know more.
No worries. I'm gonna go ahead and close this issue since its a network/systems issue. Feel free to open another issue if you get that fixed and still have issue!
I've been getting unhandled promise rejections consistently. The errors are as follows:
The code that gives me this error consistently:
Sorry that it looks a bit messy, it seems like github doesn't recognize a part of it as code. I've asked friends who are familiar with Node js to check my code and they said it was fine. When I use
paladins.ping()
I get that the ping is succesfull. usingPaladins.getDataUsed()
I receive 'null'.