Halo reach stats api?
Can someone please give me an example of how to access the Halo: Reach stats API
using jquery ajax?
Here is an exert:
GetGameHistory(System.String, System.String, System.String, System.String)
This function is used to browse through a player's history of games.
Parameters
identifier: Your application's identifier string. gamertag: The target player's gamertag. variant_class: The variant class of game to get. Valid values are "Campaign", > "Firefight", "Competitive", "Arena", "Invasion", "Custom". Pass "Unknown" to get all games. iPage: The page of results you want, starting at page 0.
Return Value A GameHistoryResponse object containing a list of the games matching the criteria you specified.
Example http://www.bungie.net/api/reach/reachapijson.svc /player/gamehistory/ {identifier}/{gamertag}/{variant_class_string}/{iPage}
here was my attempt:
var apikey = 'xxx';
var gamertag = 'The Hailwood';
var variant = 'Competitive';
var page = '0';
var url = 'http://www.bungie.net/api/reach/reachapijson.svc/player/gamehistory/'+apikey+'/'+gamertag+'/'+variant+'/'+page;
$(document).ready(function() {
$.ajax({
url: url开发者_运维问答,
success: function(data) {
$('#return').html(data);
}
});
});
However I get XMLHttpRequest cannot load http://www.bungie.net/api/reach/reachapijson.svc/player/gamehistory/xxx/The%20Hailwood/Competitive/0. Origin http://localhost is not allowed by Access-Control-Allow-Origin.
What does this mean?
Update: Ok so I fixed it by setting appropriate permissions.
But now I am getting a 400 response from the server.
Any idea what would cause this?
Update2: API IS NOT OPERATIONAL! hence why it is not working :(
This means you cant access it from a localhost url, try putting it on your server/hosting and giving it a test there. It should then work
It doesn't matter what you do. As of now the API service is down.
400 is just a generic bad request, but it's client range which means the server believes (may be lying, may be wrong) that something is wrong with your request - but it could be literally anything so it's up to the server to provide additional detail with the response to help you.
精彩评论