a node-plugin for dota2 ;
First off get a dev key from here, http://steamcommunity.com/dev/apikey and login with your Steam account and you will get unique key.
npm install dota --save
var Dota2Api = require('dota').dota2api;
var key = 'your key'; //Your personal API key (from above)
var language = 'zh_CN';// The language to retrieve results in (default is en_us) (see http://en.wikipedia.org/wiki/ISO_639-1 for the language codes (first two characters) and http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for the country codes (last two characters))
var format = 'JSON' The format to retrieve results in ("JSON" or "XML")
var dota2api = new Dota2Api(key,language,format)
var config={
account_id : '232210304',
matches_requested : 10
}
// to get the latest 10 matches played by person whth 32-bit ID 232210304
dota2api.getMatchHistory(config,function(err,data){
if(err){
throw err;
}else{
// you will get the result
console.log(data);
}
});
sed to get a list of matches played.
var config {
hero_id: < id > , // Search for matches with a specific hero being played (hero ID, not name, see HEROES below)
game_mode: < mode > , // Search for matches of a given mode (see below)
skill: < skill > , // 0 for fany, 1 for normal, 2 for high, 3 for very high skill (default is 0)
min_players: < count > , // the minimum number of players required in the match
account_id: < id > , // Search for all matches for the given user (32-bit or 64-bit steam ID)
league_id: < id > , // matches for a particular league
start_at_match_id: < id > , // Start the search at the indicated match id, descending
matches_requested: < n > , // Maximum is 25 matches (default is 25)
tournament_games_only: < string > // set to only show tournament games
}
dota2api.getMatchHistory(config, function(err, data) {
if (err) {
throw err;
} else {
// you will get the result
console.log(data);
}
})
Used to get detailed information about a specified match.
var config={
match_id=<id> // the match's ID
}
dota2api.getMatchDetails(config, function(err, data) {
if (err) {
throw err;
} else {
// you will get the result
console.log(data);
}
})