Stats
API change historyAPI that provides statistical data about Players and Matches.
Halo Wars 2 - Player Match History
Retrieves a list of Matches that the Player has participated in. If the Player is currently in a Match, it is not returned in this API.
Changelog
September 5, 2017:
- Documented new game mode "Terminus Firefight".
February 21, 2017:
- Added Endpoint.
Request
Request URL
Request parameters
-
string
The Player's Gamertag.
-
(optional)string
Indicates what Match Type the client is interested in getting Matches for ("custom" or "matchmaking").
When the parameter is omitted or empty, Matches from all Match Types are returned.
When an invalid Mode is specified, HTTP 400 ("Bad Request") is returned.
-
(optional)number
When specified, this indicates the starting index (0-based) for which the batch of results will begin at. For example, "start=0" indicates that the first qualifying result will be returned, no items are 'skipped'. Passing "start=10" indicates that the result will begin with the 11th item, the first 10 will be 'skipped'.
When omitted, zero is assumed.
When the value contains a non-digit, HTTP 400 ("Bad Request") is returned.
-
(optional)number
When specified, this indicates the maximum quantity of items the client would like returned in the response.
When omitted, 25 is assumed.
When the value contains a non-digit or is exactly "0", HTTP 400 ("Bad Request") is returned.
When the value is greater than the allowed range [1,25], the maximum allowed value is used instead. The "Count" field in the response will confirm the actual value that was used.
Request headers
Request body
Responses
200 OK
The response body will contain the Match History for the Player.
Representations
{
// Starting point that was used. When the "start" query string parameter is specified,
// this value is identical. When "start" is omitted, the default value is returned.
"Start": "int",
// Number of results that the service attempted to retrieve to satisfy this request.
// Normally this value is equal to the "count" parameter. If the client specified a
// count parameter greater than the maximum allowed, this value contains the maximum
// allowed amount.
"Count": "int",
// Number of results that are actually being returned in this response. This field is
// named "ResultCount" to avoid confusion with "Count".
"ResultCount": "int",
// A list of recent matches. Matches are listed in reverse chronological order with the
// most recently started match first.
"Results": [
{
// ID for this match. More match details are available via the "Halo Wars 2 - Match
// Result" Endpoint.
"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",
// 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"
},
},
// ID of the map the match was played on. Maps are available via the Metadata API.
"MapId": "string",
// Date and time the match started. This is expressed as an ISO 8601 combined Date
// and Time.
"MatchStartDate": {
"ISO8601Date": "string"
},
// Duration of time the player participated in the match. If the player finished
// the match, this will be equivalent to the match duration. If the player did not
// finish the match, this will be how long the player participated in the match
// until they left (with the assumption that the match potentially continued on
// without the player and the actual match duration was longer). This is expressed
// as an ISO 8601 Duration.
"PlayerMatchDuration": "string",
// Index of the player in the match.
"PlayerIndex": "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.
"PlayerCompletedMatch": "bool",
// Outcome of the match for the player. If the player did not finish the match,
// this will indicate a loss. This field will contain one of the following values:
// Unknown = 0,
// Win = 1,
// Loss = 2,
// Tie = 3
"PlayerMatchOutcome": "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.
"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.
"ChallengesXP": "int",
// Total amount of XP the player had after the match.
"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.
"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"
}
},
}
}
],
// Unused.
"Links": {}
}
404 Not Found
Specified Player was not 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/players/{player}/matches?matchType={string}&start={number}&count={number}"
-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}");
// Request parameters
queryString["matchType"] = "{string}";
queryString["start"] = "{number}";
queryString["count"] = "{number}";
var uri = "https://www.haloapi.com/stats/hw2/players/{player}/matches?" + 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/players/{player}/matches");
builder.setParameter("matchType", "{string}");
builder.setParameter("start", "{number}");
builder.setParameter("count", "{number}");
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
"matchType": "{string}",
"start": "{number}",
"count": "{number}",
};
$.ajax({
url: "https://www.haloapi.com/stats/hw2/players/{player}/matches?" + $.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/players/{player}/matches";
NSArray* array = @[
// Request parameters
@"entities=true",
@"matchType={string}",
@"start={number}",
@"count={number}",
];
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/players/{player}/matches');
$url = $request->getUrl();
$headers = array(
// Request headers
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
'matchType' => '{string}',
'start' => '{number}',
'count' => '{number}',
);
$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({
# Request parameters
'matchType': '{string}',
'start': '{number}',
'count': '{number}',
})
try:
conn = httplib.HTTPSConnection('www.haloapi.com')
conn.request("GET", "/stats/hw2/players/{player}/matches?%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({
# Request parameters
'matchType': '{string}',
'start': '{number}',
'count': '{number}',
})
try:
conn = http.client.HTTPSConnection('www.haloapi.com')
conn.request("GET", "/stats/hw2/players/{player}/matches?%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/players/{player}/matches')
query = URI.encode_www_form({
# Request parameters
'matchType' => '{string}',
'start' => '{number}',
'count' => '{number}'
})
if uri.query && uri.query.length > 0
uri.query += '&' + query
else
uri.query = query
end
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