forked from michealwillard/CS290-HowTo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
125 lines (118 loc) · 6.17 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<!--
Micheal Willard
CS 290-400
Winter 2015
-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>MLBAM API How-To</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/blog.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="blog-masthead">
<div class="container">
<nav class="blog-nav">
<a class="blog-nav-item active" href="index.html">Home</a>
</nav>
</div>
</div>
<div class="container">
<div class="blog-header">
<h1 class="blog-title">Introduction to Accessing the MLB AM API</h1>
<p class="lead blog-description">by Micheal Willard</p>
</div>
<div class="row">
<div class="col-sm-8 blog-main">
<div class="blog-post">
<h2 class="blog-post-title">About the API</h2>
<hr>
<p>
MLB Advanced Media provides an open and accesible API which contains stats, data and related information of each game played going back to 1909. The data stored in this API feeds into the MLB At Bat Application as well as the MLB websites.
</p>
<p>
The information accessed from the API in those applications also includes links to video feeds, highlights, news and other items in addition to statistics.
</p>
<p>
This How-To will walk the you through the following items:
</p>
<p>
<ul>
<li><a href="section1.html">Section 1: The API Structure</a></li>
<li><a href="section2.html">Section 2: The Date Level Folder</a></li>
<li><a href="section3.html">Section 3: The Scoreboard JSONs</a></li>
<li><a href="section4.html">Section 4: Accessing the Scoreboard Data Using Javascript</a></li>
<li><a href="example.html">Section 5: A Scoreboard Example Using Javascript</a></li>
</ul>
<p>
It is important to keep in mind that the API focuses on accessing data based on the date and the game played. This can be visualized by looking at the way the MLB At Bat App is laid out. In the image below you can see how the app is paged on a date and lists out all the scores for that date. Clicking on a score will open the stats for that game.
</p>
<img src="images/AtBatApp.png" alt="Scoreboard view for the MLB At Bat App" width="263" height="465" />
<p>The MLB AM API can be accessed through a base URL:</p>
<pre><code>
http://gd2.mlb.com/components/game/mlb/
</code></pre>
<p>If you visit <a href="http://gd2.mlb.com/components/game/mlb/">the MLB AM API URL</a> you can view the structure set up as series of URL links laid out in a folder hierarchy. You can also visit the <a href="http://gd2.mlb.com/components/game/mlb/year_2015/month_03/day_04/">Date Level Folder</a> for the above image to get a better idea of how the data translates to the posted image.
</p>
<p>
I strongly recommend visiting those link and getting a feel for the tiers and drilling down to see just how much data is available and where it is at. There is simply too much data to cover it all here, but if there is something specific you are wanting to access, poking around the API will be the quickest route to finding it.
</p>
</div><!-- /.blog-post -->
<nav>
<ul class="pager">
<!-- <li><a href="section1.html">Previous</a></li> -->
<li><a href="section1.html">Next</a></li>
</ul>
</nav>
</div><!-- /.blog-main -->
<div class="col-sm-3 col-sm-offset-1 blog-sidebar">
<div class="sidebar-module sidebar-module-inset">
<h4>About</h4>
<p>This site offers a How-To on accessing the MLB Advanced Media Api. The code is all done in Javascript, but PHP has similar methods which can be applied to attain the same effect if server side scripting is desired.</p>
</div>
<div class="sidebar-module">
<h4>Sections</h4>
<ol class="list-unstyled">
<li><a href="section1.html">Section 1: The API Structure</a></li>
<li><a href="section2.html">Section 2: The Date Level Folder</a></li>
<li><a href="section3.html">Section 3: The Scoreboard JSONs</a></li>
<li><a href="section4.html">Section 4: Accessing the Scoreboard Data Using Javascript</a></li>
<li><a href="example.html">Section 5: A Scoreboard Example Using Javascript</a></li>
</ol>
</div>
<div class="sidebar-module">
<h4>Elsewhere</h4>
<ol class="list-unstyled">
<li><a href="https://github.com/michealwillard">GitHub</a></li>
</ol>
</div>
</div><!-- /.blog-sidebar -->
</div><!-- /.row -->
</div>
<footer class="blog-footer">
<p>Blog template built for <a href="http://getbootstrap.com">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>.</p>
<p>
<a href="#">Back to top</a>
</p>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>