Do You Know the Score?

Get the score


Sports Ticker - API

Most of the routines used to get data will simply require an HTTP GET. Updates will more than likely require a POST. I will try to be as concise as I need to in order to describe how to use the Ticker API.

GetGamesByDate

MethodDescription

GetGamesByDate

Gets a list of games by date. The date must be in YYYY-mm-dd format. For instance for August 26th, 2017 you would enter 2017-08-26.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?Games=NFL&key=[YOUR KEY]&Date=Date=YYYY-mm-dd

GetGamesForTeam

MethodDescription

GetGamesForTeam

Gets a list of games by team code. For instance to get all the games to be played for the Kansas City Chiefs use the team code KC
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?Schedule=[teamCode]&key=[YOUR KEY]

GetGamesByWeek

MethodDescription

GetGamesByWeek

Gets a list of games by week. The week is the week of schedule for regular season games for NFL
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?Games=NFL&key=[YOUR KEY]&Week=[Week]

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type SCHEDULE. The description of the object is below.


SCHEDULE

PropertyData TypeDescription

seasonID

INT

* not used at the moment will always be NULL

homeID

STRING

Abbreviated home team. For instance NE for New England.

homeDesc

STRING

Home team name. For instance Broncos.

awayID

STRING

Abbreviated away team. For instance NE for New England.

awayDesc

STRING

Away team name. For instance Broncos.

gameTime

DATETIME

This will be the time in YYYY-mm-dd hh:mm:ss in which the game will start. The timezone will be in MST.

week

INT

This will be the week of the season

gameID

GUID

Unique identifier for the particular game

isPreseason

BOOLEAN

True/FALSE value as to whether this is a preseason game

IsPostSeason

BOOLEAN

True/FALSE value as to whether this is a post season game

ID

INT

ID for the game

awayScore

INT

The current score for the away team

homeScore

INT

The current score for the home team

hasStarted

BOOLEAN

TRUE/FALSE if the game has begun

IsFinal

BOOLEAN

TRUE/FALSE if the game is over

Period

INT

* not used, use the PeriodDesc instead

PeriodDesc

STRING

This will need to be documented further, but for now it will have the time in which the game starts if the games has not started, and if the game is going it will have the description of the period. If the game is over it will say Final.

Updated

DATETIME

This is when the score was last updated

BallDesc

STRING

This field will describe which team currently has the ball. If neither team has possession the value will be None. A list of values that will appear are as follows:
  • AwayFG - Away Team scored a Field Goal
  • AwayRedZone - Away Team is in the Red Zone
  • AwayTD - Away Team scored a Touchdown
  • AwayTeam - Away Team has possession
  • HomeFG - Home Team scored a Field Goal
  • HomeRedZone - Home Team is in the Red Zone
  • HomeTD - Home Team scored a Touchdown
  • HomeTeam - Home Team has possession
  • None - No team has possession

Result*

STRING

* This will be null unless GetGamesForTeam is called, when GetGamesForTeam is called this will be the result of the game, W for a win or L for a loss for the team in which the schedule was requested


UpdateScore

MethodDescription

UpdateScore

Updates the score for a particular game. Sets the period, home team score, away team score, whether the games has started, whether the game is over, and when the score was last updated.
HTTP VerbURL

POST

http(s)://joshuadahl.net/SportsTicker/Ticker.php

Returns

A result array. The first element in the array will typically be "ok" unless the user key is invalid. The second element in the list will be a "SUCCESS" or "NULL" if the score was updated.


Required
SCORE

PropertyData TypeDescription

UpdatedBy

GUID

This will be your user key. Each time you update the last update will be marked with your user key and the time that you made the update.

GameID

GUID

This is the unique identifier for the particular game that you are updating the score for. See GetGamesByDate.

AwayScore

INT

The current score of the away team.

HomeScore

INT

The current score of the home team.

PeriodDesc

STRING

This is a text field so you can put whatever you want, but please use these values 1st, 2nd, Halftime, 3rd, 4th, Final, Overtime, Rescheduled, Postponed. Your score will not be updated if the value is not one of the values mentioned.

hasStarted

BOOLEAN

If the game has started this value should be true otherwise this should be false.

IsFinal

BOOLEAN

If the game is over this should be set to true.

Example
    <form id="ScoreUpdate" >
        Away Score <br />
        <input type="number" name="AwayScore" ID="AwayScore" /><br />
        Home Score<br />
        <input type="number" name="HomeScore" ID="HomeScore" /><br />
        <select id="PeriodDesc"> <br />
            <option>1st</option>
            <option>2nd </option>
            <option>Halftime</option>
            <option>3rd</option>
            <option>4th</option>
            <option selected="">Final</option>
            <option>Overtime</option>
            <option>Postponed</option>
            <option>Rescheduled</option>
        </select><br />
        Kicked Off<br />
        <input type="checkbox" name="hasStarted" ID="hasStarted" /><br />
        Game Over<br />
        <input type="checkbox" name="IsFinal" ID="IsFinal" /><br />
        Game ID<br />
        <input type="text" name="GameID" ID="GameID" /><br />
        <input type="hidden" name="UpdateBy" ID="UpdatedBy" value="[YOURKEY]" /><br />
        <input type="button" name="submit" ID="submit" value="Submit" onclick="Update()" /><br />
    </form>

    <script type="text/javascript" >
      
    var Score = {
        UpdatedBy:'',
        GameID:'',
        AwayScore:0,
        HomeScore:0,
        PeriodDesc:'',
        IsFinal:0,
        hasStarted:0
       
      };

        function Update()
        {
            
            Score.IsFinal = document.getElementById('IsFinal').checked;
            Score.hasStarted = document.getElementById('hasStarted').checked;
            Score.AwayScore = document.getElementById('AwayScore').value;
            Score.HomeScore = document.getElementById('HomeScore').value;
            Score.UpdatedBy = document.getElementById('UpdatedBy').value;
            Score.GameID = document.getElementById('GameID').value;
            var e = document.getElementById("PeriodDesc");
            var period = e.options[e.selectedIndex].text
            Score.PeriodDesc = period;
            var dataString = JSON.stringify(Score);

            $.ajax({
                  type: "POST",
                  dataType: "json",
                  url: "http(s)://joshuadahl.net/SportsTicker/Ticker.php",
                  data: {UpdateScores:dataString},
                  success: function(data){

                      document.getElementById("result").innerHTML = data[1];

                  },
                  error: function(e){

                }
            });
        }
    </script>
    <div id="result" ></div>

        
    


GetStandingsByDivision

MethodDescription

GetStandingsByDivision

Gets a list of NFL Standings by Division. Valid divisions are: AFC North, AFC South, AFC West, AFC East, NFC North, NFC South, NFC West, NFC East ( use %20 for the space, ie NFC%20North
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?Standings=NFL&key=[YOUR KEY]&Division=[Division]

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type STANDING. The description of the object is below.


STANDING

PropertyData TypeDescription

seasonID

INT

* this will be the current year, will change

TeamID

STRING

Abbreviated home team. For instance NE for New England.

Wins

Int

Number of wins held by the team

Losses

INT

Number of losses held by the team

Ties

INT

Number of ties held by the team

PointsFor

INT

Number of points scored by the team

PointsAllowed

INT

Number of points allowed by the team

Rank

INT

Where the team ranks in the division




GetPlayersByTeam

MethodDescription

GetPlayersByTeam

Gets a list of players by team. For instance NO New Orleans
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?Games=NFL&key=[YOUR KEY]&Team=[Team]

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type PLAYER. The description of the object is below.




GetPlayersByPosition

MethodDescription

GetPlayersByPosition

Gets a list of players by position. Valid positions are: C,CB,DE,DT,FB,G,K,LB,LS,OT,P,PK,QB,RB,S,T,TE,WR
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?Games=NFL&key=[YOUR KEY]&Position=[Position]

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type PLAYER. The description of the object is below.


PLAYER

PropertyData TypeDescription

ID

INT

This is the ID of the player

FirstName

STRING

Player's first name

LastName

String

Player's last name

Jersey

INT

Player's jersey number

Weight

INT

Player's weight

Height

STRING

Player's height

Team

STRING

Player's team ie DEN for Denver


GetQBStatsForGame

MethodDescription

GetQBStatsForGame

Gets the stats for QBs for a game. Use the team's code, for instance HOU for Houston for the team parameter. For GameID see GetGamesByDate.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?GameID=[GameID]&key=[YOUR KEY]&Team=[TEAM]&Stat=QB

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type QBStat. The description of the object is below.


QBStat

PropertyData TypeDescription

PlayerID

INT

This is the ID of the player

FirstName

STRING

Player's first name

LastName

STRING

Player's last name

Position

STRING

This is the player's position, which will be QB

Attempts

INT

Number of passes attempted

Completed

INT

Number of passes completed

Interceptions

INT

Number of passes intercepted

Touchdowns

INT

Number of touchdown passes thrown

Yards

INT

Number of yards thrown

Jersey

INT

Player's jersey number

Rating

DECIMAL

QB's rating

GameID

STRING

The unique identifier for the game




GetRBStatsForGame

MethodDescription

GetRBStatsForGame

Gets the stats for RBs for a game. Use the team's code, for instance HOU for Houston for the team parameter. For GameID see GetGamesByDate.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?GameID=[GameID]&key=[YOUR KEY]&Team=[TEAM]&Stat=RB

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type RBStat. The description of the object is below.


RBStat

PropertyData TypeDescription

PlayerID

INT

This is the ID of the player

FirstName

STRING

Player's first name

LastName

String

Player's last name

Position

STRING

This is the player's position, which will be RB

Attempts

INT

Number of runs attempted

Touchdowns

INT

Number of rushing touchdowns

Yards

INT

Number of yards gained

Fumbles

INT

Number of fumbles

Jersey

INT

Player's jersey number

Long

INT

Longest rushing play

GameID

STRING

The unique identifier for the game


GetWRStatsForGame

MethodDescription

GetWRStatsForGame

Gets the stats for receiving players for a game. Use the team's code, for instance HOU for Houston for the team parameter. For GameID see GetGamesByDate.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?GameID=[GameID]&key=[YOUR KEY]&Team=[TEAM]&Stat=WR

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type WRStat. The description of the object is below.


WRStat

PropertyData TypeDescription

PlayerID

INT

This is the ID of the player

FirstName

STRING

Player's first name

LastName

STRING

Player's last name

Position

STRING

This is the player's position, it can be WR, TE, or RB

REC

INT

Number of catches

YD

INT

Total Yards receiving

TD

INT

Number of touchdown receptions

Jersey

INT

Player's jersey number

GameID

STRING

The unique identifier for the game


GetPStatsForGame

MethodDescription

GetPStatsForGame

Gets the punters stats for a game. Use the team's code, for instance HOU for Houston for the team parameter. For GameID see GetGamesByDate.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?GameID=[GameID]&key=[YOUR KEY]&Team=[TEAM]&Stat=P

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type PStat. The description of the object is below.


PStat

PropertyData TypeDescription

PlayerID

INT

This is the ID of the player

FirstName

STRING

Player's first name

LastName

STRING

Player's last name

Position

STRING

This is the player's position, it will be P

Number

INT

Number of punts

Yards

INT

Total Yards punted

In20

INT

Number of punts downed in the opposing teams 20 yard line

Jersey

INT

Player's jersey number

GameID

STRING

The unique identifier for the game


GetKStatsForGame

MethodDescription

GetKStatsForGame

Gets the kickers stats for a game. Use the team's code, for instance HOU for Houston for the team parameter. For GameID see GetGamesByDate.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?GameID=[GameID]&key=[YOUR KEY]&Team=[TEAM]&Stat=K

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type PStat. The description of the object is below.


KStat

PropertyData TypeDescription

PlayerID

INT

This is the ID of the player

FirstName

STRING

Player's first name

LastName

STRING

Player's last name

Position

STRING

This is the player's position, it will be PK

Attempts

INT

Number of extra points and field goals attempted

Made

INT

Number of extra points and field goals made

Long

INT

Longest made field goal attempt

Points

INT

Total points scored

Jersey

INT

Player's jersey number

GameID

STRING

The unique identifier for the game


GetDefenseStatsForGame

MethodDescription

GetDefenseStatsForGame

Gets defense players stats for a game. Use the team's code, for instance HOU for Houston for the team parameter. For GameID see GetGamesByDate.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?GameID=[GameID]&key=[YOUR KEY]&Team=[TEAM]&Stat=Def

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type DefenseStat. The description of the object is below.


DefenseStat

PropertyData TypeDescription

PlayerID

INT

This is the ID of the player

FirstName

STRING

Player's first name

LastName

STRING

Player's last name

Position

STRING

This is the player's position, this will include LB, CB, DE, DT, NT, and S positions

Tck

INT

Number of tackles the player has made

Ast

INT

Number of assisted tackles the player has made

Sack

INT

Number of sacks the player has made

Int

INT

Number of interceptions the player has made

Jersey

INT

Player's jersey number

GameID

STRING

The unique identifier for the game




UpdatePlay

MethodDescription

UpdatePlay

Updates the play for a particular game. Sets the down, ball position, yards gained, yards to go, time left, quarter, field position, and whether a penalty took place with a description of the penalty and play results.
HTTP VerbURL

POST

http(s)://joshuadahl.net/SportsTicker/Ticker.php

Returns

A result array. The first element in the array will typically be "ok" unless the user key is invalid. The second element in the list will be a "SUCCESS" or "NULL" if the play was updated.


Required
PLAY

PropertyData TypeDescription

GameID

GUID

This is the unique identifier for the particular game that you are updating the score for. See GetGamesByDate.

Down

STRING

This will be the down in play, or if the play is currently a kick return or punt return. Valid values:
  • 1st
  • 2nd
  • Halftime
  • 3rd
  • 4th
  • Kickoff Return
  • Punt Return

BallDesc

String

This is used to identify who has the ball. Also along with who has the ball whether the team is in the red zone, just scored a field goal or touch down. Valid values:
  • AwayFG - Away Team scored a Field Goal
  • AwayRedZone - Away Team is in the Red Zone
  • AwayTD - Away Team scored a Touchdown
  • AwayTeam - Away Team has possession
  • HomeFG - Home Team scored a Field Goal
  • HomeRedZone - Home Team is in the Red Zone
  • HomeTD - Home Team scored a Touchdown
  • HomeTeam - Home Team has possession
  • None - No team has possession

BallStart

INT

This is where the ball is currently at on the field. Valid values are 1-50

BallStartPos

STRING

This will be what side the ball is on. Valid values are Home or Away.

TotalYards

INT

This is the number of yards lost or gained on the play

YardsToGo

INT

This is the number of yards to a first down

Description

STRING

This will be the description of the play. You can enter free-form but this will change in the next revision.

IsPenalty

BOOLEAN

If the play occurred a penalty

Quarter

INT

This is the quarter the game is in. Currently only 1,2,3,4 is allowed.

TimeLeftMinutes

INT

This is the time left in minutes. Valid values are 0-15

TimeLeftSeconds

INT

This is the time left in seconds. Valid values are 0-59

UserKey

STRING

This is your user key

Example
    <form id="PlayByPlay"> 
        <h4> Play by Play </h4>
            <select id="Down" name="Down" >
               <option value="1st">1st</option>
               <option value="2nd">2nd</option>
               <option value="3rd">3rd</option>
               <option value="4th">4th</option>
               <option value="Kickoff Return">Kickoff Return</option>
               <option value="Punt Return">Punt Return</option>
           </select>            
            <label>Down</label>
            <br />
            <select id="BallDesc" name="BallDesc" >
                <option value="AwayFG">AwayFG</option>
                <option value="AwayRedZone">AwayRedZone</option>
                <option value="AwayTD">AwayTD</option>
                <option value="AwayTeam">AwayTeam</option>
                <option value="HomeFG">HomeFG</option>
                <option value="HomeRedZone">HomeRedZone</option>
                <option value="HomeTD">HomeTD</option>
                <option value="HomeTeam">HomeTeam</option>
                <option value="None">None</option>
                </select>             
            <label>Ball Possession</label>
            <br />
            <select id="BallStart" name="BallStart" >
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
                <option value="6">6</option>
                <option value="7">7</option>
                <option value="8">8</option>
                <option value="9">9</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
                <option value="13">13</option>
                <option value="14">14</option>
                <option value="15">15</option>
                <option value="16">16</option>
                <option value="17">17</option>
                <option value="18">18</option>
                <option value="19">19</option>
                <option value="20">20</option>
                <option value="21">21</option>
                <option value="22">22</option>
                <option value="23">23</option>
                <option value="24">24</option>
                <option value="25">25</option>
                <option value="26">26</option>
                <option value="27">27</option>
                <option value="28">28</option>
                <option value="29">29</option>
                <option value="30">30</option>
                <option value="31">31</option>
                <option value="32">32</option>
                <option value="33">33</option>
                <option value="34">34</option>
                <option value="35">35</option>
                <option value="36">36</option>
                <option value="37">37</option>
                <option value="38">38</option>
                <option value="39">39</option>
                <option value="40">40</option>
                <option value="41">41</option>
                <option value="42">42</option>
                <option value="43">43</option>
                <option value="44">44</option>
                <option value="45">45</option>
                <option value="46">46</option>
                <option value="47">47</option>
                <option value="48">48</option>
                <option value="49">49</option>
                <option value="50">50</option>
            </select>            
            <label>Yard line</label>
            <br />    
            <select id="BallStartPos" name="BallStartPos" >
                <option value="Away">Away</option>
                <option value="Home">Home</option>
            </select>            
            <label>Field Position</label>
            <br />
            <input type="number" name="TotalYards" id="TotalYards" >
            <label>Yards Gained</label>
            <br />     
            <input type="number" name="YardsToGo" id="YardsToGo" >
            <label>Yards To Go</label>
            <br />   
            <input type="text" name="Description" id="Description" >
            <label>Description</label>
            <br />
            <span style="display:inline-block;padding-right:10px;">Is Penalty </span>
            <input type="checkbox" name="IsPenalty" id="IsPenalty">
            <br /> 
            <br />
            <span style="display:inline-block;padding-right:10px;">Was Turnover </span>
            <input type="checkbox" name="WasTurnover" id="WasTurnover">
            <br />    
            <select id="Quarter" name="Quarter" >
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
            </select>            
            <label>Quarter</label>
            <br />
            <select id="TimeLeftMinutes" name="TimeLeftMinutes">
                <option value="15">15</option>
                <option value="14">14</option>
                <option value="13">13</option>
                <option value="12">12</option>
                <option value="11">11</option>
                <option value="10">10</option>
                <option value="9">9</option>
                <option value="8">8</option>
                <option value="7">7</option>
                <option value="6">6</option>
                <option value="5">5</option>
                <option value="4">4</option>
                <option value="3">3</option>
                <option value="2">2</option>
                <option value="1">1</option>
                <option value="0">0</option>
            </select>            
            <label>Time Left Minutes</label>
            <br />
            <select id="TimeLeftSeconds" name="TimeLeftSeconds">
                <option value="59">59</option>
                <option value="58">58</option>
                <option value="57">57</option>
                <option value="56">56</option>
                <option value="55">55</option>
                <option value="54">54</option>
                <option value="53">53</option>
                <option value="52">52</option>
                <option value="51">51</option>
                <option value="50">50</option>
                <option value="49">49</option>
                <option value="48">48</option>
                <option value="47">47</option>
                <option value="46">46</option>
                <option value="45">45</option>
                <option value="44">44</option>
                <option value="43">43</option>
                <option value="42">42</option>
                <option value="41">41</option>
                <option value="40">40</option>
                <option value="39">39</option>
                <option value="38">38</option>
                <option value="37">37</option>
                <option value="36">36</option>
                <option value="35">35</option>
                <option value="34">34</option>
                <option value="33">33</option>
                <option value="32">32</option>
                <option value="31">31</option>
                <option value="30">30</option>
                <option value="29">29</option>
                <option value="28">28</option>
                <option value="27">27</option>
                <option value="26">26</option>
                <option value="25">25</option>
                <option value="24">24</option>
                <option value="23">23</option>
                <option value="22">22</option>
                <option value="21">21</option>
                <option value="20">20</option>
                <option value="19">19</option>
                <option value="18">18</option>
                <option value="17">17</option>
                <option value="16">16</option>
                <option value="15">15</option>
                <option value="14">14</option>
                <option value="13">13</option>
                <option value="12">12</option>
                <option value="11">11</option>
                <option value="10">10</option>
                <option value="9">9</option>
                <option value="8">8</option>
                <option value="7">7</option>
                <option value="6">6</option>
                <option value="5">5</option>
                <option value="4">4</option>
                <option value="3">3</option>
                <option value="2">2</option>
                <option value="1">1</option>
                <option value="0">0</option>
            </select>            
        <label>Time Left Seconds</label>
       
        <br>
        <input type="hidden" id="userkey" name="userkey" value="[Your User Key]">
        <input type="hidden" id="playgameid" name="gameid" value="[See GameID]">
        <br />
        <input type="button" onclick="SavePlay()" value="Submit" />
        <br>
        <br>
        <div id="Results"></div>
    </form>

    <script type="text/javascript" >
      
     var Play = {
        GameID: '',
        Down:'',
        BallStart: 0,
        BallDesc: '',
        BallStartPos: '',
        TotalYards:0,
        YardsToGo:0,
        Description:'',
        IsPenalty: 0,
        WasTurnover: 0,
        Quarter: 1,
        TimeLeftMinutes:0,
        TimeLeftSeconds:0,
        UpdatedBy:'',
        IsBeta:true
    };
  
    
    function FillOutPlay()
    {
        if (document.getElementById('IsPenalty').checked)
        {
            Play.IsPenalty = 1;
        }
        else
        {
            Play.IsPenalty = 0;
        }
        if (document.getElementById('WasTurnover').checked)
        {
            Play.WasTurnover = 1;
        }
        else
        {
            Play.WasTurnover = 0;
        }
        Play.GameID = document.getElementById('playgameid').value;
        Play.UpdatedBy = document.getElementById('userkey').value;
        Play.Down = document.getElementById('Down').value;
        Play.BallStart = document.getElementById('BallStart').value;
        Play.BallDesc = document.getElementById('BallDesc').value;
        Play.BallStartPos = document.getElementById('BallStartPos').value;
        Play.Quarter = document.getElementById('Quarter').value;
        Play.Description = document.getElementById('Description').value;
        Play.TimeLeftMinutes = document.getElementById('TimeLeftMinutes').value;
        Play.TimeLeftSeconds = document.getElementById('TimeLeftSeconds').value;
        Play.TotalYards = document.getElementById('TotalYards').value;
        Play.YardsToGo = document.getElementById('YardsToGo').value;
    }
    
    function SavePlay()
    {
        FillOutPlay();
        var dataString = JSON.stringify(Play);
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "http(s)://joshuadahl.net/SportsTicker/Ticker.php",
                data: {NFLPlay:dataString},
                success: function(data){
                  
                   document.getElementById("Results").innerHTML = data[1];
                },
                error: function(e){
                    
                }
            });
        
    }
   
    </script>
    <div id="Results" ></div>

        
    


GetNFLPlaysForGame

MethodDescription

GetNFLPlaysForGame

Gets the current play by play for a particular game. The GameID is a GUID, see GetGamesByWeek to obtain the GUID to pass.
HTTP VerbURL

GET

http(s)://joshuadahl.net/SportsTicker/Ticker.php?Games=NFL&key=[YOUR KEY]&GameID=[See GameID]

Returns

A Result Array in JSON. The first element in the array will be the result of invocation. Typically this is going to be "ok" if everything was good, or INVALID KEY. The second element in the array is going to be an array of type NFLPlay. The description of the object is below.


NFLPlay

PropertyData TypeDescription

Quarter

INT

The quarter in which the play took place

Time

STRING

The time the clock was at when the play was finished

Down

STRING

This will be the down in play, or if the play is currently a kick return or punt return.
  • 1st
  • 2nd
  • Halftime
  • 3rd
  • 4th
  • Kickoff Return
  • Punt Return

BallDesc

STRING

This will have the team code ie NE of who currently has the ball.

BallOn

INT

The yard line the ball is on for the particular play.

Side

STRING

This will have the team code on which side the ball is on ie OAK.

Yards

INT

Yards gained on the play

YardsToGo

INT

Yards to go for a first down or 0 for goal to go.

Description

STRING

A description of what took place on the particular play.

IsPenalty

BOOLEAN

This will be set if there was a penalty on the play.

LastUpdate

DATETIME

Timestamp when the play was submitted.