Stats
API change historyAPI that provides statistical data about Players and Matches.
Halo Wars 2 - Match Result
Retrieves detailed statistics for a Match. Matches can be retrieved before they are completed; however, the data for in-progress Matches is only updated every few minutes.
Changelog
September 5, 2017:
- Documented new game mode "Terminus Firefight".
February 21, 2017:
- Added Endpoint.
Request
Request URL
Request parameters
-
string
An ID that uniquely identifies a Match. Match IDs can be retrieved from the "Halo Wars 2 - Player Match History" Endpoint.
Request headers
Request body
Responses
200 OK
The response body will contain the Match Result.
Representations
{
// ID for this match.
"MatchId": "guid",
// Match type for this match. This field will contain one of the following values:
// Unknown = 0,
// Campaign = 1,
// Custom = 2,
// Matchmaking = 3
"MatchType": "int",
// Game mode for this match. This field will contain one of the following values:
// Unknown = 0,
// CampaignSolo = 1,
// CampaignCooperative = 2,
// Deathmatch = 3,
// Domination = 4,
// Strongholds = 5,
// Blitz = 6,
// Firefight = 7,
// NormalTutorial = 8,
// BlitzTutorial = 9,
// TerminusFirefight = 10
"GameMode": "int",
// Season ID for the match if the match occurred in a ranked playlist; otherwise, null.
// Seasons are available via the Metadata API.
"SeasonId": "guid",
// Playlist the match occurred in if the match occurred in a playlist; otherwise, null
// or empty Guid. Playlists are available via the Metadata API.
"PlaylistId": "guid",
// ID of the map the match was played on. Maps are available via the Metadata API.
"MapId": "string",
// Whether the match is in-progress or completed. If the match is not complete, many
// fields will not be set.
"IsMatchComplete": "bool",
// Reason the match ended. If the match is not complete, this will be null. This field
// will contain one of the following values:
// Unknown = 0,
// Completed = 1,
// StartedNewMission = 2,
// EveryoneDisconnected = 3,
// InviteAccepted = 4
"MatchEndReason": "int",
// Reason the winning team achieved victory. If the match is not complete, this will be
// null. This field will contain one of the following values:
// EndedPrematurely = 0,
// ObjectiveCompleted = 1,
// OpponentsEliminated = 2,
// Unknown = 255
"VictoryCondition": "int",
// Date and time the match started. This is expressed as an ISO 8601 combined Date and
// Time.
"MatchStartDate": {
"ISO8601Date": "string"
},
// Duration of the match. This is expressed as an ISO 8601 Duration.
"MatchDuration": "string",
// Information regarding the teams in the match. Neutral teams are not included in this
// collection.
"Teams": {
// Team ID.
"int": {
// Number of players on the team.
"TeamSize": "int",
// Outcome for the team in the match. If the match is not complete, this will be
// null. This field will contain one of the following values:
// Unknown = 0,
// Win = 1,
// Loss = 2,
// Tie = 3
"MatchOutcome": "int",
// Score for the team at the end of the match. If the match is not complete, this
// will be null.
"ObjectiveScore": "int"
}
},
// Information regarding the players in the match. Netural players are not included in
// this collection.
"Players": {
// Player Index.
"int": {
// Whether this represents a human player or a computer player.
"IsHuman": "bool",
// Identify of the player if this is a human player; otherwise, null.
"HumanPlayerId": {
// Gamertag of the player.
"Gamertag": "string",
// Internal use. This will always be null.
"Xuid": null
},
// ID of the computer player if this is a computer player; otherwise, null.
"ComputerPlayerId": "int",
// Difficulty of the computer player if this is a computer player; otherwise, null.
// Difficulties are available via the Metadata API.
"ComputerDifficulty": "int",
// ID of the team the player was a member of.
"TeamId": "int",
// Index of the player on their team. This is derived by sorting all the players on
// a team by their PlayerIndex and selecting the resulting position.
"TeamPlayerIndex": "int",
// Leader the player used. Leaders are available via the Metadata API.
"LeaderId": "int",
// Whether the player finished the match. This will be null until either the player
// leaves the match or the match is complete.
"PlayerCompletedMatch": "bool",
// Duration of time the player participated in the match. This will be null until
// either the player leaves the match or the match is complete.
"TimeInMatch": "string",
// Outcome of the match for the player. This will be null until either the player
// leaves the match or the match is complete. If the player leaves the match early,
// the player might have a different match outcome than their team. This field will
// contain one of the following values:
// Unknown = 0,
// Win = 1,
// Loss = 2,
// Tie = 3
"PlayerMatchOutcome": "int",
// Information about the capture points the player interacted with in the match. If
// the match is not complete, this will be null.
"PointStats": {
// ID of the capture point.
"string": {
// Number of times the player captured the point.
"TimesCaptured": "int"
}
},
// Information about the units the player interacted with in the match. If the
// match is not complete, this will be null.
"UnitStats": {
// ID of the unit. Units are available via the Metadata API as Game Objects.
"string": {
// Number of times the player trained a unit of this type.
"TotalBuilt": "int",
// Number of times the player lost a unit of this type.
"TotalLost": "int",
// Number of times the player assisted in killing a unit of this type.
"TotalDestroyed": "int"
}
},
// Information about the cards the player used in the match. If the match is not
// complete, this will be null.
"CardStats": {
// ID of the card. Cards are available via the Metadata API.
"guid": {
// Number of times the player played a card of this type.
"TotalPlays": "int"
}
},
// Information about the waves the player participated in. If the match is not
// complete, this will be null.
"WaveStats": {
// Wave number.
"int": {
// Duration of how long the team the player was on took to complete the wave.
// This is expressed as an ISO 8601 Duration.
"WaveDuration": "string"
}
},
// Information about the leader powers the player used in the match. If the match
// is not complete, this will be null.
"LeaderPowerStats": {
// ID of the leader power. Leader Powers are available via the Metadata API.
"string": {
// Number of times the player used a leader power of this type.
"TimesCast": "int"
}
},
// XP progress the player earned as a result of their participation in the match.
"XPProgress": {
// Total amount of XP the player had when they entered the match.
"PreviousTotalXP": "int",
// XP the player earned as a result of actions taken in the match. This does not
// include XP the player earned as a result of challenges completed in the match,
// which is reported separately. If the match is not complete, this will be 0.
"GameplayXP": "int",
// XP the player earned as a result of completing challenges in the match. This
// does not include XP the player earned as a result of actions taken in the
// match, which is reported separately. If the match is not complete, this will
// be 0.
"ChallengesXP": "int",
// Total amount of XP the player had after the match. If the match is not
// complete, this will be 0.
"UpdatedTotalXP": "int",
// Spartan Ranks the player completed as a result of the XP earned in the match.
// If this collection is empty, the player did not earn enough XP in this match
// to complete a rank. There is no significance to the ordering of this
// collection.
"CompletedSpartanRanks": [
{
// Spartan Rank the player completed. Spartan Ranks are available via the
// Metadata API.
"Id": "guid",
// Packs the player was awarded as a result of completing the rank. There is
// no significance to the ordering of this collection. Packs are available
// via the Metadata API.
"PacksAwarded": [ "guid" ]
}
]
},
// Rating progress the player earned as a result of their participation in the
// match.
"RatingProgress": {
// Competitive Skill Ranking (CSR) of the player before the match started. If the
// match did not occur in a ranked playlist, this will be null.
"PreviousCsr": {
// CSR Tier. CSR Tiers are designation-specific. If the player is still in
// measurement matches, this field will be null. CSR Tiers are referenced by
// CSR Designations, which are available via the Metadata API.
"Tier": "int",
// CSR Designation. If the player is still in measurement matches, this field
// will be null. CSR Designations are available via the Metadata API.
"Designation": "int",
// Raw CSR value. If the player is still in measurement matches, this field
// will be null. If the player is not in a high enough designation, this will
// be zero.
"Raw": "int",
// Percentage of progress towards the next CSR tier. If the player is still in
// measurement matches, this field will be null.
"PercentToNextTier": "int",
// Number of measurement matches remaining until the player earns a CSR. If
// this field is greater than zero, the player does not have a CSR yet and the
// other components of the CSR will be null.
"MeasurementMatchesRemaining": "int",
// Player's ranking on the CSR leaderboard. If the player is still in
// measurement matches, this field will be null. If the player is not in a high
// enough designation, this will be zero.
"Rank": "int"
},
// Competitive Skill Ranking (CSR) of the player after the match ended. If the
// match did not occur in a ranked playlist, this will be null. If the match is
// not complete, this will be null.
"UpdatedCsr": {
// CSR Tier. CSR Tiers are designation-specific. If the player is still in
// measurement matches, this field will be null. CSR Tiers are referenced by
// CSR Designations, which are available via the Metadata API.
"Tier": "int",
// CSR Designation. If the player is still in measurement matches, this field
// will be null. CSR Designations are available via the Metadata API.
"Designation": "int",
// Raw CSR value. If the player is still in measurement matches, this field
// will be null. If the player is not in a high enough designation, this will
// be zero.
"Raw": "int",
// Percentage of progress towards the next CSR tier. If the player is still in
// measurement matches, this field will be null.
"PercentToNextTier": "int",
// Number of measurement matches remaining until the player earns a CSR. If
// this field is greater than zero, the player does not have a CSR yet and the
// other components of the CSR will be null.
"MeasurementMatchesRemaining": "int",
// Player's ranking on the CSR leaderboard. If the player is still in
// measurement matches, this field will be null. If the player is not in a high
// enough designation, this will be zero.
"Rank": "int"
},
// Internal use.
"PreviousMmr": {
"Rating": "double",
"Variance": "double",
// Unused.
"LastModifiedDate": {
"ISO8601Date": "string"
}
},
// Internal use.
"UpdatedMmr": {
"Rating": "double",
"Variance": "double",
// Unused.
"LastModifiedDate": {
"ISO8601Date": "string"
}
}
}
}
}
}
404 Not Found
The specified Match could not be found.
Representations
500 Internal Server Error
Internal Server Error
Representations
503 Service Unavailable
Service Unavailable
Representations
Code samples
@ECHO OFF
curl -v -X GET "https://www.haloapi.com/stats/hw2/matches/{matchId}"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
--data-ascii "{body}"
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;
namespace CSHttpClientSample
{
static class Program
{
static void Main()
{
MakeRequest();
Console.WriteLine("Hit ENTER to exit...");
Console.ReadLine();
}
static async void MakeRequest()
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");
var uri = "https://www.haloapi.com/stats/hw2/matches/{matchId}?" + queryString;
var response = await client.GetAsync(uri);
}
}
}
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class JavaSample
{
public static void main(String[] args)
{
HttpClient httpclient = HttpClients.createDefault();
try
{
URIBuilder builder = new URIBuilder("https://www.haloapi.com/stats/hw2/matches/{matchId}");
URI uri = builder.build();
HttpGet request = new HttpGet(uri);
request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request body
StringEntity reqEntity = new StringEntity("{body}");
request.setEntity(reqEntity);
HttpResponse response = httpclient.execute(request);
HttpEntity entity = response.getEntity();
if (entity != null)
{
System.out.println(EntityUtils.toString(entity));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function() {
var params = {
// Request parameters
};
$.ajax({
url: "https://www.haloapi.com/stats/hw2/matches/{matchId}?" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
},
type: "GET",
// Request body
data: "{body}",
})
.done(function(data) {
alert("success");
})
.fail(function() {
alert("error");
});
});
</script>
</body>
</html>
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString* path = @"https://www.haloapi.com/stats/hw2/matches/{matchId}";
NSArray* array = @[
// Request parameters
@"entities=true",
];
NSString* string = [array componentsJoinedByString:@"&"];
path = [path stringByAppendingFormat:@"?%@", string];
NSLog(@"%@", path);
NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
[_request setHTTPMethod:@"GET"];
// Request headers
[_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
// Request body
[_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response = nil;
NSError *error = nil;
NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
if (nil != error)
{
NSLog(@"Error: %@", error);
}
else
{
NSError* error = nil;
NSMutableDictionary* json = nil;
NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
NSLog(@"%@", dataString);
if (nil != _connectionData)
{
json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
}
if (error || !json)
{
NSLog(@"Could not parse loaded json with error:%@", error);
}
NSLog(@"%@", json);
_connectionData = nil;
}
[pool drain];
return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://www.haloapi.com/stats/hw2/matches/{matchId}');
$url = $request->getUrl();
$headers = array(
// Request headers
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_GET);
// Request body
$request->setBody("{body}");
try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}
?>
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.urlencode({
})
try:
conn = httplib.HTTPSConnection('www.haloapi.com')
conn.request("GET", "/stats/hw2/matches/{matchId}?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.parse.urlencode({
})
try:
conn = http.client.HTTPSConnection('www.haloapi.com')
conn.request("GET", "/stats/hw2/matches/{matchId}?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
require 'net/http'
uri = URI('https://www.haloapi.com/stats/hw2/matches/{matchId}')
request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body