CHPP Development/XML/live

From Hattrick
Jump to navigationJump to search

This page offers XML and HTML interfaces to follow up to 10 matches simultaneously in one application (using the same application multiple time to increase the amount of games is not allowed). The XML interface enables CHPP developers to integrate match viewing into their applications.

Current version

Current version of the XML output is 1.2

Syntax

live.asp?
     outputType = {HTML | XML}
     actionType = {view | viewNew | viewAll | clearAll | addMatch | deleteMatch}
     [matchID = integer]

Indata parameters

outputType

Indicates whether the output to the client should be an HTML document or an XML file. Only the XML document may be used for CHPP use.

actionType

Indicates what type of action the page should perform:

Value Default Description
view Yes Show the latest event(s) for all tracked matches. If matchID is supplied, that match will be shown with all events since the start of the game ("expanded" view).
viewNew Show those matches where new events have occured since last request of the page. All the events that have taken place since last request will be shown.
viewAll Show all the events for all matches. Only available with outputType = XML.
clearAll Remove all tracked matches from the tracking session.
addMatch Add a new match to be tracked. With this actionType, a matchID must be supplied.

(Note that matchID works as normal, so the new match will automatically be in "expanded" mode). If outputType = XML, the output will be identical to viewAll.

deleteMatch Remove a particular match from the session. With this actionType, a matchID must be supplied.

matchID

Specifies that a certain match should be shown as "expanded", that is, all the events are shown rather than only the latest. This parameter is required for certain actionTypes (see specification for actionType parameter).

Outdata parameters

The XML output can contain the following tags/containers:

HattrickData

Generic tag wrapped around all XML data from Hattrick.

FileName (Within HattrickData)

The name of the file that your request was sent to.

UserID (Within HattrickData)

The logged on User's UserID (not to be confused with TeamID). If not logged on, it defaults to 0.

Version (Within HattrickData)

The current version number of the XML output.

FetchedDate (Within HattrickData)

Date and time when the XML file was fetched. Format is YYYY-MM-DD HH:MM:SS.

MatchList (Within HattrickData)

Container for all the matches.

Match (Within MatchList)

The container for a match. An attribute called Index signifies the number of the match in the list (not to be confused with MatchID which is globally unique).

MatchID (Within Match)

The globally unique identifier of the match.

MatchDate (Within Match)

The start date (kick-off) of the match.

HomeTeam (Within Match)

The Home (formal, not taking arena location into account) team of the match.

HomeTeamID (Within HomeTeam)

The teamID of the Home team in the match.

HomeTeamName (Within HomeTeam)

The team name of the Home team in the match.

AwayTeam (Within Match)

The away (formal, not taking arena location into account) team of the match.

AwayTeamID (Within AwayTeam)

The teamID of the away team in the match.

AwayTeamName (Within AwayTeam)

The team name of the away team in the match.

HomeGoals (Within Match)

The current number of goals in the match for the home team.

AwayGoals (Within Match)

The current number of goals in the match for the away team.

EventList (Within Match)

Container for all the events.

Event (Within EventList)

Container for the data for a certain event. An attribute named ID is returned to indicate the order of the event relative to the other events sent in the same batch for this match.

Minute (Within Event)

The match minute when the event happened.

EventKey (Within Event)

A unique key defining what type of event it was. A list of event keys can be found here, thanks to BC-redeker.

EventText (Within Event)

String describing the event as it would appear in the match report.

SubjectTeamID (Within Event)

Integer that, for goals and chances, is indicating the attacking team. For other event, this field usually indicates the team that is doing something. It may indicate other things for other events - exxactly what is not documented here and the SubjectTeamID information, while free to use for CHPPs is "unsupported" and used "at your own risk".

SubjectPlayerID (Within Event)

Integer that, for goals and chances, is indicating the scorer or the player failing to score. For other events, this field usually indicates the primarily active player. It may indicate other things for other events and like SubjectTeamID is unsupported and used at your own risk..

ObjectPlayerID (Within Event)

Integer that, for regular goals and chances, is indicating the defending team's goal keeper. For special event chances/goals, the ObjectPlayer is often the assisting player of the attacking team, but can be any other player that is involved in the event. For other events, this field is used very freely and can indicate any kind of relevant integer data. Like SubjectPlayerID and SubjectTeamID, it is unsupported and used at your own risk.