Stats
API change historyAPI that provides statistical data about Players and Matches.
Halo Wars 2 - Player Stats Summary
Retrieves high-level aggregations across the lifetime of a Player.
Changelog
September 5, 2017:
- Added additional fields: "GameMode" and "HighestObjectiveScoreByTeamSize".
- Documented new game mode "Terminus Firefight".
February 21, 2017:
- Added Endpoint.
Request
Request URL
Request parameters
-
string
The Player's Gamertag.
Request headers
Request body
Responses
200 OK
The response body will contain the Stats Summary for the Player.
Representations
//
// Main Response
//
{
// Summary of activity across all Custom matches that the player has participated in.
"CustomSummary": {
// Summary of activity across all Skirmish matches (player(s) vs. AI(s)) that the
// player has participated in.
"SkirmishStats": {
// Summary of activity across all Skirmish matches that contained only the player.
// This will contain a single Summary. The Summary contract is documented in detail
// below the documentation for the Main Response.
"SinglePlayerStats": "Summary",
// Summary of activity across all Skirmish matches that contained two or more human
// players that the player has participated in. This will contain a single Summary.
// The Summary contract is documented in detail below the documentation for the
// Main Response.
"MultiplayerStats": "Summary",
// Summary of activity across all Skirmish matches that contained only the player,
// separated by game mode. This will contain multiple Summary entries, one for each
// game mode. The Summary contract is documented in detail below the documentation
// for the Main Response.
"SinglePlayerModeStats": [ "Summary" ],
// Summary of activity across all Skirmish matches that contained two or more human
// players that the player has participated in. This will contain multiple Summary
// entries, one for each game mode. The Summary contract is documented in detail
// below the documentation for the Main Response.
"MultiplayerModeStats": [ "Summary" ],
},
// Summary of activity across all non-Skirmish matches that the player has
// participated in. This will contain a single Summary. The Summary contract is
// documented in detail below the documentation for the Main Response.
"CustomStats": "Summary",
// Summary of activity across all non-Skirmish matches that the player has
// participated in, separated by game mode. This will contain multiple Summary
// entries, one for each game mode. The Summary contract is documented in detail
// below the documentation for the Main Response.
"CustomModeStats": [ "Summary" ]
},
// Summary across all matchmade matches that the player has participated in. This
// includes both social and ranked matches, matches from all seasons, and matches from
// all game modes.
"MatchmakingSummary": {
// Summary across all matches in social (unranked) playlists. This may include
// summary information from playlists that are no longer playable. Playlists that the
// player has never played in are omitted from this collection. Note that is possible
// for a playlist to go between social and ranked. Consumers of this endpoint should
// be careful about the possibility that a playlist appears in both collections. This
// will contain a Summary entry for each playlist. The Summary contract is documented
// in detail below the documentation for the Main Response.
"SocialPlaylistStats": [ "Summary" ],
// Summary across all matches in ranked playlists. This may include summary
// information from playlists that are no longer playable. Playlists that the player
// has never played in are omitted from this collection. Note that is possible for a
// playlist to go between social and ranked. Consumers of this endpoint should be
// careful about the possibility that a playlist appears in both collections. The
// Summary contract is documented in detail below the documentation for the Main
// Response.
"RankedPlaylistStats": [ "Summary" ],
// Summary across all matches in social (unranked) playlists, separated by game mode.
// This may include summary information from playlists that are no longer playable.
// Playlists that the player has never played in are omitted from this collection.
// Note that is possible for a playlist to go between social and ranked. Consumers of
// this endpoint should be careful about the possibility that a playlist appears in
// both collections. This will contain multiple Summary entries, one for each
// playlist and game mode combination. The Summary contract is documented in detail
// below the documentation for the Main Response.
"SocialModeStats": [ "Summary" ],
// Summary across all matches in ranked playlists, separated by game mode. This may
// include summary information from playlists that are no longer playable. Playlists
// that the player has never played in are omitted from this collection. Note that is
// possible for a playlist to go between social and ranked. Consumers of this
// endpoint should be careful about the possibility that a playlist appears in both
// collections. This will contain multiple Summary entries, one for each playlist and
// game mode combination. The Summary contract is documented in detail below the
// documentation for the Main Response.
"RankedModeStats": [ "Summary" ],
}
}
//
// Summary
//
{
// Playlist ID that this entry summarizes. If this entry summarizes Custom matches,
// this will be null. Playlists are available via the Metadata API.
"PlaylistId": "guid",
// When summarizing a set of matches that took place in a common playlist, this field
// provides the current classification. This field will contain one of the following
// values:
// General Stats = 0,
// Blitz Stats = 1,
// Firefight Stats = 2
// If this entry summarizes Custom matches, this will be null.
"PlaylistClassification": "int",
// Highest Competitive Skill Ranking (CSR) achieved by the player in the playlist. If
// the player has never finished the measurement matches on this playlist, this field
// will be null. If this entry does not summarize ranked matches, this will be null.
"HighestCsr": {
// 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"
},
// Total amount of time the player spent in matches. This includes time spent observing
// the match after being eliminated. This is expressed as an ISO 8601 Duration.
"TotalTimePlayed": "string",
// Total number of matches that the player participated in.
"TotalMatchesStarted": "int",
// Total number of matches where the player was present until the match ended.
"TotalMatchesCompleted": "int",
// Total number of matches that the player won.
"TotalMatchesWon": "int",
// Total number of matches that the player lost.
"TotalMatchesLost": "int",
// Total number of times the player has captured a point.
"TotalPointCaptures": "int",
// Total number of units trained by the player.
"TotalUnitsBuilt": "int",
// Total number of units trained by the player that were later destroyed.
"TotalUnitsLost": "int",
// Total number of units that the player participated in destroying.
"TotalUnitsDestroyed": "int",
// Total number of times the player played a card, if applicable; otherwise, 0.
"TotalCardPlays": "int",
// Highest wave completed while the player was still present in a match, if applicable;
// otherwise, 0.
"HighestWaveCompleted": "int",
// Summary for all leaders used by the player.
"LeaderStats": {
// Leader ID. Leaders are available via the Metadata API.
"string": {
// Total amount of time the player spent in matches with this leader. This includes
// time spent observing the match after being eliminated. This is expressed as an
// ISO 8601 Duration.
"TotalTimePlayed": "string",
// Total number of matches that the player participated in with this leader.
"TotalMatchesStarted": "int",
// Total number of matches where the player was present until the match ended with
// this leader.
"TotalMatchesCompleted": "int",
// Total number of matches that the player won with this leader.
"TotalMatchesWon": "int",
// Total number of matches that the player lost with this leader.
"TotalMatchesLost": "int",
// Total number of times the player used this leader's active leader power.
"TotalLeaderPowersCast": "int"
}
},
// Game mode that this entry summarizes. If this entry is not summarizing a game mode
// pivot, this field will be null. Otherwise, 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",
// Highest objective score that the player has ever achieved in matches summarized by
// this entry. This field is a mapping from the team size to the highest objective
// score achieved.
"HighestObjectiveScoreByTeamSize": {
"int": "int",
}
}
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}/stats"
-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/players/{player}/stats?" + 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}/stats");
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/players/{player}/stats?" + $.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}/stats";
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/players/{player}/stats');
$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/players/{player}/stats?%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/players/{player}/stats?%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}/stats')
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