这篇文章的源地址: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使用:

(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/

常用选项:

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

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)

GetMatchHistory
Used to get a list of matches played.

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

例子:

根据某人的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

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

  • 使用查询到的最后一场match_id来作为新一次查询的start_at_match_id:
  • https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=<key>&start_at_match_id=<id>&<OTHER_OPTIONS>
  • 使用查询到的最后一场starttime来作为新一次查询的date_max:
  • https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?key=<key>&date_max=<id>&<OTHER_OPTIONS>

返回结果的字段格式:

  • num_results - 在返回数据中,查询到结果的数量
  • total_results - 这次particular查询到结果的总数[(total_results / num_results) = total_num_pages]
  • results_remaining - 这次查询结果剩余未返回的数量 [(results_remaining / num_results) = remaining_num_pages]
  • matches - 有num_results个数量比赛的数组:
      • match_id - 比赛的数字ID
      • match_seq_num - 比赛序号 - the order in which matches are recorded
      • start_time - date in UTC seconds since Jan 1, 1970 (unix time format)

    lobby_type

      - lobby值的对应关系

      • 5 = Team match.
      • 4 = Co-op with bots.
      • 3 = Tutorial.
      • 2 = Tournament.
      • 1 = Practice.
      • 0 = Public matchmaking.
      • -1 = Invalid.
    • players - 玩家数组:

      • account_id - 玩家的32位Steam ID - 如果玩家将自己的资料设为隐私,account_id将会是"4294967295"
      • player_slot - 8位unsigned int型: if the left-most bit is set, the player was on dire. the two right-most bits represent the player slot (0-4).
      • hero_id - 玩家所玩英雄的数字ID (见下方)

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

返回结果的字段格式:

  • players - 玩家数组
    • account_id - 玩家的32位Steam ID - 如果玩家将自己的资料设为隐私,account_id将会是"4294967295"
    • player_slot - 8位unsigned int型: if the left-most bit is set, the player was on dire. the two right-most bits represent the player slot (0-4).
    • hero_id - 玩家所玩英雄的数字ID
    • item_0 - 比赛结束时玩家的物品栏 左上 物品ID
    • item_1 - 比赛结束时玩家的物品栏 中上 物品ID
    • item_2 - 比赛结束时玩家的物品栏 右上 物品ID
    • item_3 - 比赛结束时玩家的物品栏 左下 物品ID
    • item_4 - 比赛结束时玩家的物品栏 中下 物品ID
    • item_5 - 比赛结束时玩家的物品栏 右下 物品ID
    • kills - 杀人数
    • deaths - 死亡数
    • assists - 助攻数
    • leaver_status
      • NULL - 玩家是电脑
      • 2 - 玩家放弃比赛
      • 1 - 玩家在比赛可以安全退出后放弃比赛
      • 0 - 玩家完成了整场比赛
    • gold - 玩家在比赛结束之后剩余的金钱
    • last_hits - 正补数
    • denies - 反补数
    • gold_per_min - 玩家每秒金钱
    • xp_per_min - 玩家每秒经验
    • gold_spent - 整场比赛玩家花费的金钱
    • hero_damage - 对英雄伤害
    • tower_damage - 对塔伤害
    • hero_healing - 对其他英雄的治疗量
    • level - 最后的等级
    • ability_upgrades - 一个数组详细的记录玩家每次加点记录
      • ability - 所加技能的ID
      • time - 加点时间(/秒)从比赛开始计算
      • level - 加点等级
    • additional_units - 玩家额外控制的单位信息 (其实就是熊德的宝宝)
      • unitname - 单位名字
      • item_0 - 比赛结束时物品栏 左上 物品ID
      • item_1 - 比赛结束时物品栏 中上 物品ID
      • item_2 - 比赛结束时物品栏 右上 物品ID
      • item_3 - 比赛结束时物品栏 左下 物品ID
      • item_4 - 比赛结束时物品栏 中下 物品ID
      • item_5 - 比赛结束时物品栏 右下 物品ID
    • season - ?
    • radiant_win - radiant赢了为true,false反之
    • duration - 整场比赛的用时
    • start_time - date in UTC seconds since Jan 1, 1970 (unix time format)
    • match_id - 比赛数字ID
    • match_seq_num - 比赛序号 - the order in which matches are recorded
    • tower_status_radiant - 11位 unsinged int: 见此链接
    • tower_status_dire - 11位 unsinged int: 见此链接
    • barracks_status_radiant - 6位 unsinged int: 见此链接
    • barracks_status_radiant - 6位 unsinged int: 见此链接 (吐槽,应该是dire不是radiant吧,还有应该是unsigned不是unsinged吧)
    • cluster - 见下方的REPLAYS
    • first_blood_time - 一血诞生的时间
    • replay_salt - 见下方REPLAYS 目前已从API中移除
    • lobby_type - lobby类型 (见上方GetMatchHistory)
    • human_players - 比赛中human players的数量
    • leagueid - 比赛所属leauge的ID (见上方GetMatchHistory)
    • positive_votes - 多少人顶
    • positive_votes - 多少人踩(估计这个写错了,应该是 negative_votes -多少人踩)
    • game_mode - 比赛模式
      • '1' : 'All Pick',
      • '2' : "Captains Mode",
      • '3' : 'Random Draft',
      • '4' : 'Single Draft',
      • '5' : 'All Random',
      • '6' : '?? INTRO/DEATH ??',
      • '7' : 'The Diretide',
      • '8' : "Reverse Captains Mode",
      • '9' : 'Greeviling',
      • '10' : 'Tutorial',
      • '11' : 'Mid Only',
      • '12' : 'Least Played',
      • '13' : 'New Player Pool'
    • 接下来的字段只会在 teams applied to radiant and dire 的时候有(i.e. this is a league match in a private lobby (英文不好,话说radiant和dire分别代表天辉和夜魇么?)
      • radiant_name - radiant 队伍的名字
      • radiant_logo -  radiant 队伍的LOGO (想要获得图片, 见下方FAQ)
      • radiant_team_complete - true为所有radiant的成员都属于本队伍, false反之 (i.e. are the stand-ins {false} or not {true})
      • dire_name - dire队伍的名字
      • dire_logo - the dire 队伍的LOGO (想要获得图片, 见下方FAQ)
      • dire_team_complete - true为所有dire的成员都属于本队伍, false反之  (i.e. are the stand-ins {false} or not {true})

下篇地址:http://www.cnblogs.com/Scohura/p/3600973.html

你应该在开始API开发之前知道的事(上)(翻译)的更多相关文章

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

    放了十多天,一直在玩没写,今天终于要把坑填完了.有部分没翻,主要是一般都用不上的,有兴趣的朋友可以自己翻下. 上篇地址 :http://www.cnblogs.com/Scohura/p/357360 ...

  2. 第六代智能英特尔® 酷睿™ 处理器图形 API 开发人员指南

    欢迎查看第六代智能英特尔® 酷睿™ 处理器图形 API 开发人员指南,该处理器可为开发人员和最终用户提供领先的 CPU 和图形性能增强.各种新特性和功能以及显著提高的性能. 本指南旨在帮助软件开发人员 ...

  3. 天气预报API开发

    天气预报API开发 一.        寻觅篇 最近想要跟着视频练习一下利用API开发一个天气预报系统,就在网上找了一下可以用的API,结果好多都已经失效了... 1.       百度车联网天气预报 ...

  4. 高性能PHP框架thinkphp5.0.0 Beta发布-为API开发而设计

    ThinkPHP V5.——为API开发而设计的高性能框架 ThinkPHP5..0版本是一个颠覆和重构版本,采用全新的架构思想,引入了很多的PHP新特性,优化了核心,减少了依赖,实现了真正的惰性加载 ...

  5. ASP.NET Core Web API 开发-RESTful API实现

    ASP.NET Core Web API 开发-RESTful API实现 REST 介绍: 符合REST设计风格的Web API称为RESTful API. 具象状态传输(英文:Representa ...

  6. 基于.Net Framework 4.0 Web API开发(2):ASP.NET Web APIs 参数传递方式详解

    概述:  ASP.NET Web API 的好用使用过的都知道,没有复杂的配置文件,一个简单的ApiController加上需要的Action就能工作.调用API过程中参数的传递是必须的,本节就来谈谈 ...

  7. API 开发实践

    整个2015年,如果要给自己打上一个标签的话,那应该就是 API. 在各个不同的系统中定制各种 API 框架. 在做商城对接各种电商 ERP 的 API 开发中,我采用的是兼容SHOPEX 的 API ...

  8. 报表引擎API开发入门— EJB程序数据源

    我们前面讲了几个数据源,今天我们来讲一下EJB数据源,这篇讲完我们数据源这部分就讲完了.数据连接不需要直接访问数据库,而是使用EJB做为数据源.FR通过定义程序数据集使用EJB的相关类获取到EJB数据 ...

  9. Rest API 开发 学习笔记(转)

    Rest API 开发 学习笔记 概述 REST 从资源的角度来观察整个网络,分布在各处的资源由URI确定,而客户端的应用通过URI来获取资源的表示方式.获得这些表徵致使这些应用程序转变了其状态.随着 ...

随机推荐

  1. 【转载】使用Pandas创建数据透视表

    使用Pandas创建数据透视表 本文转载自:蓝鲸的网站分析笔记 原文链接:使用Pandas创建数据透视表 目录 pandas.pivot_table() 创建简单的数据透视表 增加一个行维度(inde ...

  2. JavaScript 冒泡排序和选择排序

    var array = [1,2,3,4,5]; // ---> 服务 //效率 ---> 针对一个有序的数组 效率最高 //标志 true false for(var j = 0; j ...

  3. codevs2800 送外卖

    题目描述 Description 有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上.n个不同的客户分别在1~n个编号的城市中.送外卖的从0号城市出发,然后n个城市都要走一 ...

  4. [Math & Algorithm] 拉格朗日乘数法

    拉格朗日乘数法(Lagrange Multiplier Method)之前听数学老师授课的时候就是一知半解,现在越发感觉拉格朗日乘数法应用的广泛性,所以特意抽时间学习了麻省理工学院的在线数学课程.新学 ...

  5. Windows 7个性化配置,关闭Win7动画效果,设置窗口背景为“ 豆绿色”

    减少眼睛疲劳配色(豆绿色): RGB:, , ,颜色名称:#C7EDCC 1.任务栏设置 2.关闭Win7动画效果 控制面板 -> 轻松访问 -> 优化视频显示 3.去掉窗口阴影 右键单击 ...

  6. 【安卓】安卓res文件夹下的资源文件与R.java文件里面类的对应关系

    对于drawable.layout.menu文件夹下的每一个文件都分别会在R.java文件里面生成drawable.layout.menu类的一个常量,类名就是文件夹的名字,常量的名字就是文件名字. ...

  7. python之路五

    内建模块 time和datetime 在Python中,通常有这几种方式来表示时间:1)时间戳 2)格式化的时间字符串 3)元组(struct_time)共九个元素.由于Python的time模块实现 ...

  8. JavaSE18章_JSON解析详解

    一.JSON简介 JSON(JavaScript Object Notation),是一种轻量级的数据交换格式.JSON是存储和交换文本信息的,语法类似 XML.易于人阅读和编写,同时也易于机器解析和 ...

  9. iOS UIStackView的理解

    iOS9 提供的UIStackview简化了布局操作,它有些像Android中的liner layout.以前不用UIStackview也是可以做出类似的效果的,不过要添加许多的约束,看得头都大了,使 ...

  10. OC编程之道-创建对象之生成器模式

    生成器模式也叫建造者模式,一般是用来构造复杂对象的一种模式.client(客户)-director(指导者)-builder(构造者)-product(产品). 生成器模式能帮助构建设计部件与表现的各 ...