关于DOTA 2 Match History WebAPI 的 源网页地址: http://dev.dota2.com/showthread.php?t=47115

由于源网页全英文,这边做下翻译方便以后自己及他人查阅(如有翻译不正确的地方请指正):

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

首先登录 http://steamcommunity.com/dev/apikey ,你将获得你的API唯一密钥,请不要在做WebAPI请求的时候泄露或被其他人查看到

以下是两个获取DOTA2匹配历史记录的API:

获得匹配历史记录:

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

将<key> 替换成你自己的API密钥,这样就会以JSON形式得到最新的25场公开匹配,你也可以要求以XML格式返回通过:

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

获得最新的25场匹配. 如果想要获得更早的25场匹配记录, 请使用字段 "start_at_match_id" ,将你获得的一个match_id填入其中:(即获取以match_id作为最新一场的25场匹配历史记录)

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

如果想要获取匹配的具体内容,使用这个API:

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

接下来额外的字段也可以使用在获取匹配历史记录:

player_name=<name> # 通过玩家名字搜索匹配, 仅限精确匹配
hero_id=<id> # 通过特定的英雄搜索, 英雄的ID在你的DOTA安装目录 dota/scripts/npc/npc_heroes.txt 中
skill=<skill> # 0为任意 , 1为N , 2为H, 3为VH
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)
account_id=<id> # Steam账号ID (不是Steam的登录ID, 而是数字ID)
league_id=<id> # 该联赛ID的比赛记录
start_at_match_id=<id> # 从填入的匹配记录ID开始,降序
matches_requested=<n> # 默认25场,可以改低

举个例子,获得最新的一场匹配记录:

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

一起来探讨这个功能吧. 我们迫不及待的想要看到人们想出如何使用这些信息。

Please do be nice and not slam the WebAPI’s too heavily, however! Thanks!


关于WebAPI比较经常被问到的问题:

我如何根据GetMatchDetails的信息获得录像?
Replays由下面的URL组成:

http://replay<cluster>.valve.net/570/<match_id>_<replay_salt>.dem.bz2

其中 cluster, match_id 和 replay_salt 可以在GetMatchDetails中得到. 如果你好奇cluster是什么, 这是指该匹配所在的游戏服务器数据中心.

是否可以通过API获得非公开匹配的匹配记录和详情?
目前不可以. 我们正在寻找一个可能的OATUH认证系统,在能够保证玩家账号安全的情况下获取他们的匹配记录,并提供给第三方网站获取。我们希望有更多的相关信息尽快公布。

我该如何找到hero_id和item所对应的英雄和物品?
这些对应可以在你的DOTA2安装目录下被找到。
英雄:
Steam/steamapps/common/dota 2 beta/gamedota/scripts/npc/npc_heroes.txt
物品:
Steam/steamapps/common/dota 2 beta/gamedota/scripts/npc/items.txt

是否有正在进行的比赛的WebAPI?
还没有,但这真是个绝佳的想法

关于API调用次数是否有限制呢?
目前没有,但是如果匹配服务器正忙或者你频繁调用超出限制,你将可能获得503错误。请等待30秒然后重试。 因为在API开放上有个很好的经验法则就是,限制你每秒发送的请求。

来自DOTA2开发团队的更新(应该是关于当时天梯事件,而后关闭了API一段时间的通知,懒得翻了。。。)
大家注意,WebAPI现在无法访问。 What happened was that we were seeing such an overwhelming demand from people for this information that our servers were getting completely bogged down servicing all of these requests. None of the behavior we saw was malicious, there was just way too much demand and unfortunately it really started impacting the experience of general DOTA players and therefore we had to disable it for now. This is of course super interesting information and we want to make it as available to as many people as we possibly can and we are working on a couple of solutions to help greatly improve the situation so we can handle more requests, but can’t give any definitive time frame for when these will be brought online. We will keep you posted as things develop, but hopefully our solutions will let us have our cake and eat it too (after all not all cakes are a lie).

As a side note though, if people are developing against this API, make sure to implement rate limiting within your systems. We don’t have any numbers at this point, but we of course need to prevent individual accounts from submitting thousands of requests in a small window so that we can make sure that we can handle a reasonable number of users. Also if people have specific queries that they are running in large quantities that don’t naturally fit into the existing API let us know so that if it is a common request people have that the system can efficiently handle those requests.

DOTA 2 Match History WebAPI(翻译)的更多相关文章

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

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

  2. iptables配置——NAT地址转换

    iptables nat 原理同filter表一样,nat表也有三条缺省的"链"(chains): PREROUTING:目的DNAT规则 把从外来的访问重定向到其他的机子上,比如 ...

  3. React Router 按需加载+服务器渲染的闪屏问题

    伴随着React协议的『妥协』(v16采用MIT),React为项目的主体,这个在短期内是不会改变的了,在平时使用过程中发现了如下这个问题: 在服务器渲染的时候,刷新页面会出现闪屏的现象(白屏一闪而过 ...

  4. React Router 4.0 基本使用

    路由的概念,起初来源于服务端,就是当浏览器访问一个网站的不同页面时,服务端能够正确的返回页面的内容.当访问首页时,它能返回首页的内容,访问关于我们页面时,返回关于我们的内容.可以看到路由就是一种控制和 ...

  5. 23.react-router 路由

    箭头函数扩展: 箭头函数: functoin 函数名(参数){    函数体 } 箭头函数: 1.把function删掉 , 2.参数和{}之间加上 箭头=> 简写: 1.参数的简写:只有一个参 ...

  6. Codeforces Round #222 (Div. 1) C. Captains Mode 状压

    C. Captains Mode 题目连接: http://codeforces.com/contest/377/problem/C Description Kostya is a progamer ...

  7. 初学者的React全家桶完整实例

    概述 该项目还有些功能在开发过程中,如果您有什么需求,欢迎您与我联系.我希望能够通过这个项目对React初学者,或者Babel/webpack初学者都有一定的帮助.我在此再强调一下,在我写的这些文章末 ...

  8. 第七章 : Git 介绍 (下)[Learn Android Studio 汉化教程]

    Learn Android Studio 汉化教程 Let’s reset even further to remove all traces of your work on the deprecat ...

  9. GYM 101550 G.Game Rank(模拟)

    The gaming company Sandstorm is developing an online two player game. You have been asked to impleme ...

随机推荐

  1. TCP/IP——链路层

    链路层主要有三个目的: (1)为IP模块发送和接收IP数据报; (2)为ARP模块发送 ARP请求和接收 ARP应答; (3)为RARP发送RARP请求和接收RARP应答. TCP / IP支持多种不 ...

  2. Redis总结(四)Redis 的持久化

    前面已经总结了Redis 的安装和使用今天讲下Redis 的持久化. redis跟memcached类似,都是内存数据库,不过redis支持数据持久化,也就是说redis可以将内存中的数据同步到磁盘来 ...

  3. Q: ossfs挂载时如何设置权限?

    Q: ossfs挂载时如何设置权限? 如果要允许其他用户访问挂载文件夹,可以在运行ossfs的时候指定allow_other参数: ossfs your_bucket your_mount_point ...

  4. zabbix注入过程分析

    Zabbix jsrpc.php sql 注入过程分析 漏洞公开详情(https://support.zabbix.com/browse/ZBX-11023)中提示在insertDB() 中的inse ...

  5. [Head First设计模式]饺子馆(冬至)中的设计模式——工厂模式

    系列文章 [Head First设计模式]山西面馆中的设计模式——装饰者模式 [Head First设计模式]山西面馆中的设计模式——观察者模式 [Head First设计模式]山西面馆中的设计模式— ...

  6. 用 const 还是用 let?

    ES6 里新增了两种声明变量的方式,let 和 const,加上原来的 var,一共就有三种方式来声明变量了.那到底该用哪个呢?关于“尽可能不用 var” 这一点,大家应该没有什么意见分歧(其实还是有 ...

  7. tyvj1202 数数食物链

    描述 TsyD学习了生物的生态环境那一张后,老师留了一项作业,就是给一张食物网,求所有食物链的总数.(从最低营养级生物(它不能吃任何其他的生物)开始到最高营养级(它不能被任何其他生物吃) 叫做一条食物 ...

  8. cf723d Lakes in Berland

    The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cel ...

  9. Wampserver主机服务配置方法

    一.更改根目录  1.左键”www目录”路径更改Wampserver安装好后,“www目录”默认为X:\wamp\www,也就是wampserver安装目录下的www文件夹.实际使用中,默认设置往往不 ...

  10. ecshop调用后台指定广告位下所有广告循环

    ecshop本身的广告调用规则是:对某个广告位下的广告列表随机显示其中一条. 而我们有时需要将某个广告位下的所有广告全部显示出来,那么如何处理呢,下面就自己做了一个函数: \includes\lib_ ...