你应该在开始API开发之前知道的事(上)(翻译)

时间:2014-03-02 11:45:09   收藏:0   阅读:750

这篇文章的源地址:http://dev.dota2.com/showthread.php?t=58317

 

由于文章内容较多,英语水平有限,准备尝试着以中英混搭的形式翻译,免得曲解一些不懂内容的意思。以下开始为翻译内容:

 

这篇文章会持续更新, 请在suggesting missing items前查看底部的TODO List

Web开发者现在可以以JSON或者XML格式,获得匹配历史记录及详情并使用在他们自己的应用中。 

首先点击这里阅读WebAPI的条款协议

获得密钥

首先登录 http://steamcommunity.com/dev/apikey ,你将获得你的API唯一密钥。

请不要在做WebAPI请求的时候泄露或被其他人查看到。

 

来自Zoid的说明:

 

当你到 http://steamcommunity.com/dev/apikey 申请API时,the "domain" field is just a note. 事实上没有任何需要用到的地方, 只是一个 helpful field 让你能够告诉我们你的网站是哪个. 你也可以暂时填入你的名字. 一旦你获得了Key, 这个Key就是当你执行API请求时我们对你的唯一标示。

 

API请求

提供以下API使用:

bubuko.com,布布扣
(GetMatchHistory)              https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/v001/
(GetMatchDetails)              https://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/v001/
(GetHeroes)                    https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/
(GetPlayerSummaries)           https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/
(EconomySchema)                https://api.steampowered.com/IEconItems_570/GetSchema/v0001/
(GetLeagueListing)             https://api.steampowered.com/IDOTA2Match_570/GetLeagueListing/v0001/
(GetLiveLeagueGames)           https://api.steampowered.com/IDOTA2Match_570/GetLiveLeagueGames/v0001/    
(GetMatchHistoryBySequenceNum) https://api.steampowered.com/IDOTA2Match_570/GetMatchHistoryBySequenceNum/v0001/
(GetTeamInfoByTeamID)          https://api.steampowered.com/IDOTA2Match_570/GetTeamInfoByTeamID/v001/
bubuko.com,布布扣

常用选项:

注意,除非另有说明,否则默认为空或忽略

bubuko.com,布布扣
key=<key>       # Your personal API key (from above)
language=<lang> # 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))
format=<form>   # The format to retrieve results in ("JSON" or "XML") (default is JSON)
bubuko.com,布布扣

GetMatchHistory
Used to get a list of matches played.

bubuko.com,布布扣
player_name=<name>             # Search matches with a player name, exact match only 
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 any, 1 for normal, 2 for high, 3 for very high skill (default is 0)
date_min=<date>                # date in UTC seconds since Jan 1, 1970 (unix time format) 
date_max=<date>                # date in UTC seconds since Jan 1, 1970 (unix time format)
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
bubuko.com,布布扣

例子:

根据某人的32位ID获得其最近的25场比赛

https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=<key>&account_id=XXXXX

获得最近的一场比赛

https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=<key>&matches_requested=1

注意,为了能够到”下一页“,你需要做这么一两件事:

返回结果的字段格式:

GetMatchDetails

Used to get detailed information about a specified match.

可用的选项:

match_id=<id> # the match‘s ID

例子:

根据ID "XXXXX"获得比赛详细记录:、

https://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/V001/?key=<key>&match_id=XXXXX

返回结果的字段格式:

你应该在开始API开发之前知道的事(上)(翻译),布布扣,bubuko.com

原文:http://www.cnblogs.com/Scohura/p/3573606.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!