分享使用接口调用的示例代码,Dota2的【近期赛事列表】接口。

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;/*** @API: 近期赛事列表*/
public class DotaMatch {public static void main(String[] args) {try {String content = getContent();Respond rsp = JSON.parseObject(content, Respond.class);System.out.println(rsp.code);System.out.println(rsp.message);rsp.getMatchList().forEach(System.out::println);} catch (Throwable t) {t.printStackTrace();}}/*** 获取API返回内容* <p>* Note: 这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容*/private static String getContent() {try {StringBuilder builder = new StringBuilder();List<String> lines = Files.readAllLines(Paths.get("./src/main/resources/DotaMatch.json"), StandardCharsets.UTF_8);lines.forEach(builder::append);return builder.toString();} catch (Throwable t) {t.printStackTrace();return "";}}public static class Respond {@JSONFieldprivate int code;@JSONFieldprivate String message;@JSONField(name = "data")private List<Match> matchList;public void setCode(int code) {this.code = code;}public void setMessage(String message) {this.message = message;}public void setMatchList(List<Match> matchList) {this.matchList = matchList;}public int getCode() {return code;}public String getMessage() {return message;}public List<Match> getMatchList() {return matchList;}}public static class Match {@JSONFieldprivate String matchId;@JSONFieldprivate String leagueId;@JSONFieldprivate long matchTime;@JSONFieldprivate int status;@JSONFieldprivate int round;@JSONFieldprivate String roundName;@JSONFieldprivate String roundNameEn;@JSONFieldprivate int roundSession;@JSONFieldprivate String roundType;@JSONFieldprivate List<Long> battleIds;@JSONFieldprivate long guessId;@JSONFieldprivate long groupId;@JSONFieldprivate int bo;@JSONFieldprivate int teamAScore;@JSONFieldprivate int teamAId;@JSONFieldprivate int teamBScore;@JSONFieldprivate int teamBId;@Overridepublic String toString() {return "Match{" +"matchId=" + matchId +", leagueId=" + leagueId +", matchTime=" + matchTime +", status=" + status +", round=" + round +", roundName='" + roundName + '\'' +", roundNameEn='" + roundNameEn + '\'' +", roundSession=" + roundSession +", roundType='" + roundType + '\'' +", battleIds=" + battleIds +", guessId=" + guessId +", groupId=" + groupId +", bo=" + bo +", teamAScore=" + teamAScore +", teamAId=" + teamAId +", teamBScore=" + teamBScore +", teamBId=" + teamBId +'}';}public void setMatchId(String matchId) {this.matchId = matchId;}public void setLeagueId(String leagueId) {this.leagueId = leagueId;}public void setMatchTime(long matchTime) {this.matchTime = matchTime;}public void setStatus(int status) {this.status = status;}public void setRound(int round) {this.round = round;}public void setRoundName(String roundName) {this.roundName = roundName;}public void setRoundNameEn(String roundNameEn) {this.roundNameEn = roundNameEn;}public void setRoundSession(int roundSession) {this.roundSession = roundSession;}public void setRoundType(String roundType) {this.roundType = roundType;}public void setBattleIds(List<Long> battleIds) {this.battleIds = battleIds;}public void setGuessId(long guessId) {this.guessId = guessId;}public void setGroupId(long groupId) {this.groupId = groupId;}public void setBo(int bo) {this.bo = bo;}public void setTeamAScore(int teamAScore) {this.teamAScore = teamAScore;}public void setTeamAId(int teamAId) {this.teamAId = teamAId;}public void setTeamBScore(int teamBScore) {this.teamBScore = teamBScore;}public void setTeamBId(int teamBId) {this.teamBId = teamBId;}}
}

API 返回数据如下(部分):

200
成功
Match{matchId=lgwil078j7il44l0350m798j57j5685j473l, leagueId=L006341, matchTime=1566270000000, status=0, round=1, roundName='胜者组第一轮(BO3)', roundNameEn='Upper Bracket Round 1 (BO3)', roundSession=1, roundType='win', battleIds=[], guessId=100180639, groupId=6478492, bo=3, teamAScore=0, teamAId=2667, teamBScore=0, teamBId=4941}
Match{matchId=lgwi1mki177k19k0n23m1j2lk8944460jk09, leagueId=L006341, matchTime=1566279000000, status=0, round=1, roundName='胜者组第一轮(BO3)', roundNameEn='Upper Bracket Round 1 (BO3)', roundSession=2, roundType='win', battleIds=[], guessId=100180642, groupId=6478492, bo=3, teamAScore=0, teamAId=2688, teamBScore=0, teamBId=68278}
Match{matchId=lgwiin0n2312n5l2005mk9mij9k9n2nm4380, leagueId=L006341, matchTime=1566286800000, status=0, round=1, roundName='败者组第一轮(BO1)', roundNameEn='Lower Bracket Round 1(BO1)', roundSession=1, roundType='lose', battleIds=[], guessId=100180627, groupId=6478492, bo=1, teamAScore=0, teamAId=4910, teamBScore=0, teamBId=79203}
Match{matchId=lgwi5145ij9kkj4ji82ni752m632778m428j, leagueId=L006341, matchTime=1566293400000, status=0, round=1, roundName='败者组第一轮(BO1)', roundNameEn='Lower Bracket Round 1(BO1)', roundSession=2, roundType='lose', battleIds=[], guessId=100180630, groupId=6478492, bo=1, teamAScore=0, teamAId=4168, teamBScore=0, teamBId=4196}
Match{matchId=lgwin906838196423imiji17l3k224k0492k, leagueId=L006341, matchTime=1566297000000, status=0, round=1, roundName='败者组第一轮(BO1)', roundNameEn='Lower Bracket Round 1(BO1)', roundSession=3, roundType='lose', battleIds=[], guessId=100180633, groupId=6478492, bo=1, teamAScore=0, teamAId=79981, teamBScore=0, teamBId=2665}
Match{matchId=lgwimijl42i6l3lj4m8l1210j97k799570n3, leagueId=L006341, matchTime=1566310200000, status=0, round=1, roundName='败者组第一轮(BO1)', roundNameEn='Lower Bracket Round 1(BO1)', roundSession=4, roundType='lose', battleIds=[], guessId=100180636, groupId=6478492, bo=1, teamAScore=0, teamAId=4132, teamBScore=0, teamBId=4314}
Match{matchId=lgwi996456l2lmnl2173imi61600498k0nm9, leagueId=L006341, matchTime=1566352800000, status=0, round=1, roundName='胜者组第一轮(BO3)', roundNameEn='Upper Bracket Round 1 (BO3)', roundSession=3, roundType='win', battleIds=[], guessId=100180645, groupId=6478492, bo=3, teamAScore=0, teamAId=4929, teamBScore=0, teamBId=79262}
Match{matchId=lgwil713knkil4n03m2509n1ij120kj85mmi, leagueId=L006341, matchTime=1566363600000, status=0, round=1, roundName='胜者组第一轮(BO3)', roundNameEn='Upper Bracket Round 1 (BO3)', roundSession=4, roundType='win', battleIds=[], guessId=100180648, groupId=6478492, bo=3, teamAScore=0, teamAId=4982, teamBScore=0, teamBId=4955}

电竞Dota2数据API接口 - 【近期赛事列表】API调用示例代码相关推荐

  1. dota2 java_电竞Dota2数据API接口 - 【战队列表】调用示例代码

    分享调用飞鲸电竞数据DOTA2的数据接口,在线接口文档,需注册 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annota ...

  2. PHP LOL接口,电竞LOL数据API接口 - 【即时指数】调用示例代码

    电竞LOL数据api指数接口,在线调用文档,需注册 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.J ...

  3. 淘宝/天猫关键词搜索店铺列表 API接口,店铺列表API接口,店铺商品API接口

    一.淘宝/天猫关键词搜索店铺列表 API接口,店铺列表API接口,店铺商品API接口参数如下: 1.公共参数: 名称 类型 必须 描述 key String 是 调用key(必须以GET方式拼接在UR ...

  4. 1688店铺所有商品API接口、店铺列表API接口

    可以通过1688店铺所有商品API接口采集店铺所有商品详情页各项数据,包含商品标题,SKU信息.价格.优惠价,收藏数.销量.SKU图.标题.详情页图片等店铺内页面上有的数据均可以拿到,大家都知道,16 ...

  5. 电竞DOTA2数据API接口 - 【比赛详情】API调用示例代码

    分享使用 野子电竞数据 http://www.xxe.io 接口调用的示例代码,接的是DOTA2的[比赛详情]数据接口. 请求方法: GET https://api.xxe.io/?resource= ...

  6. 电竞Dota2数据API接口 - 【联赛列表】API调用示例代码

    分享使用接口调用的示例代码,Dota2的[联赛列表]接口. import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotati ...

  7. PHP LOL接口,电竞英雄联盟数据API接口 - 【赛事列表】API调用示例代码

    野子电竞数据官网改版https://www.xxe.io/全新登场 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.anno ...

  8. 电竞Dota2数据API接口 - 【战队列表】API调用示例代码

    分享使用接口调用的示例代码,Dota2的[战队列表]接口. import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotati ...

  9. 电竞DOTA2数据API接口 - 【即时指数】API调用示例代码

    分享使用接口调用的示例代码,DOTA2的[即时指数]接口. import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotati ...

最新文章

  1. 解决xcode打开时假死的问题
  2. 【原创】oracle的归档模式
  3. Cpp 对象模型探索 / 虚基类表作用
  4. eclipse中查看android源码
  5. 联想电脑g470 vs2010很卡 问题解决
  6. matlab火焰测温源程序,一种火焰测温方法与流程
  7. java cygwin,cygwin和java
  8. 《孙子兵法战场机变之军争篇》
  9. 《逆流而上+阿里巴巴技术成长之路》 免费电子版
  10. 【RocketMQ】Send [1] times, still failed以及No route info of this topic问题排查思路总结
  11. 习题5-5 使用函数统计指定数字的个数(15 分)
  12. 2014 【第五届蓝桥杯校内选拔赛】 C/C++ B组
  13. 28 岁的我,一事无成
  14. Android win10 平板 省电,小编解答win10系统Mobile设置更省电的图文办法
  15. grep 命令的使用
  16. 2019年暑期GooGle SWE 凉经
  17. 给OkHttp Client添加socks代理
  18. 品Spring:详细解说bean后处理器
  19. SVN 具体某一行代码是谁添加的
  20. 饥荒联机云服务器_饥荒联机专用服务器搭建教程

热门文章

  1. 焦作机器人编程比赛_第二十届全国中小学生电脑制作活动“机器人竞赛”焦作选拔赛成功举办...
  2. setTimeout与setTimeinterval的使用
  3. pyhton输油管问题
  4. python对话机器人怎么搭建代码语言库_教你用python几十行代码编写对话机器人
  5. 美国10月JOLTs职位空缺达历史第二高位 Omicron变种或导致近期经济数据差于预期
  6. curve25519-dalek中的Scalar模运算mul/sub/add/div
  7. spark RDD解密学习笔记
  8. 部署windows 2003虚拟机
  9. Andy:创业三年的几个感悟
  10. 尚硅谷SpringMVC项目无法解析MVC视图‘index‘无法跳转到index.html