分享使用接口调用的示例代码,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. linux之find命令详解
  2. perl 引用(一)
  3. 利用redis实现分布式锁
  4. java setlt;intgt;_java使用Nagao算法实现新词发现、热门词的挖掘
  5. IntelliJ IDEA 的 Project Structure 窗口中的 Artifacts 勾选 Include in project build
  6. python在材料模拟中的应用_材料模拟python_模拟-python模拟-在不妨碍实现的情况下修补方法...
  7. localStorage/cookie 用法分析与简单封装
  8. [deviceone开发]-do_Album的简单示例
  9. [html] 给“测试投影”几个字添加立体投影的效果
  10. hbase filter原理_HBase应用|HBase在移动广告监测产品中的应用
  11. Apollo自动驾驶入门课程第⑥讲 — 预测
  12. 开源项目面试重要吗_您的开源故事很重要
  13. asp.net 二级域名表单认证情况下共享Cookie
  14. sourceTree 的使用
  15. Training_model(2)
  16. Chipmunk2D中文手册
  17. 车辆维修管理系统mysql_4S店汽车维修管理系统的分析与设计(JSP+MySQL)
  18. 翟菜花:为什么说社区会是虚拟偶像驶向未来的新航标?
  19. 如何使用STM32 HAL库驱动TFT-LCD实现手画板功能
  20. dell笔记本指示灯闪烁_Dell笔记本电源灯黄灯一直闪烁是什么问题 争决方法

热门文章

  1. 电子学会C语言一级模拟题:收集瓶盖赢大奖
  2. 永远不要去依赖别人_永远不要太依赖别人
  3. java relativelayout_用java代码写RelativeLayout的layout_below逻辑,你不知道的坑
  4. 【ionic】ionic代码利用Jenkins构建部署出错
  5. easyui-textbox的回显 换行→getValue
  6. 计算机应用基础实验指导2015,2015计算机应用基础实验.doc
  7. C语言复制文本文件(功能)
  8. C++STL算法 adjacent_find计算字符串的长度倍数时防止除零错误
  9. 华为不上市真的是因为不缺钱么?
  10. 学生成绩查找系统(C语言)