Forums / Support / Halo API Support

HaloSharp (A C# Wrapper) (v2.0.1.0 - 2017-03-22)

OP Furiousn00b

  1. 1
  2. ...
  3. 2
  4. 3
  5. ...
  6. 4
I've built a C# wrapper for the so-far-released Game Data API. It fully covers all the available endpoints and is dead simple to use.

  • 100% up-to-date with all applicable games (Halo 5, Halo 5: Forge, Halo Wars 2).
  • Simple query builders for all endpoints.
  • Rate-limiter (based on your access)
  • Response caching.
It's available on my GitHub: github.com/gitFurious/HaloSharp. The licence is permissive, so feel free to use as you like.
Looks good. Makes me want to wrap up the API in TypeScript for JS developers.
Man you don't waste any time. Great job! Don't forget to add the profile points too :)
HT xorth wrote:
Man you don't waste any time. Great job! Don't forget to add the profile points too :)
Thanks xorth ;)

I've got the Profile endpoints GetEmblemImage and GetSpartanImage. Have I missed something or do you mean something else?
Very nice! Thank you for making your code available.
Thanks for this!

I wish I was smarter.
Great, thanks! Will definitely try this out, before creating my own :-)

EDIT: Dang it, I was hoping I could use this together with Unity, but unfortunately Unity is currently using a subset of .Net 3.5, and your wrapper is set to .net 4.5 :\ Thanks anyways! Will probably make my own with inspiration from yours, if that's okay?
Halotracker.com has a CSR leaderboard, looking through the API I didn't see anything that looked like it would support this, how do you suppose that was implemented?
Cornydood wrote:
Halotracker.com has a CSR leaderboard, looking through the API I didn't see anything that looked like it would support this, how do you suppose that was implemented?
I think one of the devs for Halotracker mentioned that the leaderboard only contains players who's stats have been requested from the API. I'm guessing they're just recording the CSR from the Service Record and then ranking them. HT xorth can probably confirm if that's the case.
Cornydood wrote:
Halotracker.com has a CSR leaderboard, looking through the API I didn't see anything that looked like it would support this, how do you suppose that was implemented?
I think one of the devs for Halotracker mentioned that the leaderboard only contains players who's stats have been requested from the API. I'm guessing they're just recording the CSR from the Service Record and then ranking them. HT xorth can probably confirm if that's the case.
That makes sense, would be nice to see some functionality added to the API to support this easier. I noticed also that all the Ranks are returning as 1 for Champions, so without knowing what other players CSR score is there is really no way to know.
Cornydood wrote:
Halotracker.com has a CSR leaderboard, looking through the API I didn't see anything that looked like it would support this, how do you suppose that was implemented?
I think one of the devs for Halotracker mentioned that the leaderboard only contains players who's stats have been requested from the API. I'm guessing they're just recording the CSR from the Service Record and then ranking them. HT xorth can probably confirm if that's the case.
Correct. Luckily the top CSR players use stats site so we can keep pretty good tabs on people. We certainly don't have anywhere near all the people who have ever played though.
Updated to version 1.1.0.0

New Features:
  • Rate Limiter: A smart rate limiter that supports limiting burst and sustained requests. Can optionally be disabled.
  • JSON Structural Validation (JSON Schema): JSON schema validation for all endpoints. Can easily validate strongly typed mode and keep an eye on any API changes/updates.
  • Serialization: All models now support serialization.
  • Seasons Endpoint: Added new metadata endpoint.
  • Profile Endpoints: Both Spartan and Emblem image endpoints now return both the image and the image URI.
  • Expansive Unit Tests
Yep, nice thing :) Working on a soon-public C# Async-Gui-Sample-Project ;)
Screen:
What ya see is already workin':
Screen: http://i.imgur.com/N5dKVPH.png
Code will be Full-Documentated.

Current-Progress GitHub Repo:
https://github.com/Fresh-Dev/HaloSharp-MaterialGui
v.1.2.0.0 (2016-01-31) out now!

Changelog:
  1. Query validation.
    • Validation exceptions will be thrown for bad queries (missing mandatory fields, invalid gamertags etc.).
  2. Updated GetArenaServiceRecord query.
    • New SeasonId parameter.
  3. Updated ArenaServiceRecord model.
    • New property: ArenaPlaylistStatsSeasonId
    • New property: HighestCsrSeasonId
  4. Updated Requisition model.
    • New property: LevelRequirement
  5. Bug fixes :)
v.1.2.1.0 (2016-01-14) out now!

Added changes documented here.
Hey Furiosn00b! I appreciate all of the work you have put into this. I have been using it for a small little program I wrote. I hate to bug you with this, but I was wondering if something changed around GetMedals(). I haven't changed anything around that, but an error is thrown when running the following:

Quote:
var medalSet = await session.Query(new GetMedals());
It throws the following error:
Quote:
An exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in mscorlib.dll but was not handled in user code
Additional information: Error converting value "Goal" to type 'HaloSharp.Model.Enumeration+MedalType'. Path '[18].classification', line 1, position 8294.
The full error details are here:

http://pastebin.com/QbSWZ9u7

b
b01000100 wrote:
Hey Furiosn00b! I appreciate all of the work you have put into this. I have been using it for a small little program I wrote. I hate to bug you with this, but I was wondering if something changed around GetMedals(). I haven't changed anything around that, but an error is thrown when running the following:

Quote:
var medalSet = await session.Query(new GetMedals());
It throws the following error:
Quote:
An exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in mscorlib.dll but was not handled in user code
Additional information: Error converting value "Goal" to type 'HaloSharp.Model.Enumeration+MedalType'. Path '[18].classification', line 1, position 8294.
The full error details are here:

http://pastebin.com/QbSWZ9u7

b
Cheers for reaching out.

343 have pushed an update for the API and there are a couple of small changes (see here).

I've just updated the HaloSharp NuGet package. Grab the latest version and you're good to go.
v.1.2.3.0 (2016-02-25) out now!

Added changes documented here.
OK, another one for you. I am getting odd results when running the following for different people:

Quote:
await session.Query(new GetArenaServiceRecord().ForPlayer(gamertag))
If I run it for myself (b01000100), it works like it always has. If I run it for most of the people in my company, it works just fine. If I run it for a guy I play with (Omnickpotent), it throws the following:

Quote:
Newtonsoft.Json.JsonSerializationException was unhandled by user code
HResult=-2146233088
Message=Error converting value "NonSeasonal" to type 'System.Nullable`1[System.Guid]'. Path 'Results[0].Result.ArenaStats.HighestCsrSeasonId', line 1, position 63341.
Source=Newtonsoft.Json
Full details on Pastebin [edit: just realized my link was removed because of my rank here] Here is the link as text: http://pastebin.com/RzicPj7v

I can run both on the examples website and get back similar data. Obviously it will be different based on playlists and such, but HighestCsrAttained exists in (roughly) the same place for both. Running it through my program using the same code will give me a failure for that player. It also fails in the same way for the following people in my company:

Spoiler:
Show
Any idea, off the top of your head, as to why it is failing?
b01000100 wrote:
OK, another one for you. I am getting odd results when running the following for different people:

Quote:
await session.Query(new GetArenaServiceRecord().ForPlayer(gamertag))
If I run it for myself (b01000100), it works like it always has. If I run it for most of the people in my company, it works just fine. If I run it for a guy I play with (Omnickpotent), it throws the following:

Quote:
Newtonsoft.Json.JsonSerializationException was unhandled by user code
HResult=-2146233088
Message=Error converting value "NonSeasonal" to type 'System.Nullable`1[System.Guid]'. Path 'Results[0].Result.ArenaStats.HighestCsrSeasonId', line 1, position 63341.
Source=Newtonsoft.Json
Full details on Pastebin [edit: just realized my link was removed because of my rank here] Here is the link as text: http://pastebin.com/RzicPj7v

I can run both on the examples website and get back similar data. Obviously it will be different based on playlists and such, but HighestCsrAttained exists in (roughly) the same place for both. Running it through my program using the same code will give me a failure for that player. It also fails in the same way for the following people in my company:

Spoiler:
Show

Any idea, off the top of your head, as to why it is failing?
I've been able to reproduce this.

The documentation for 'HighestCsrSeasonId' says:
Quote:
// The ID for the season that pertains to the highest obtained CSR field across all seasons. If the CSR is null, so is this field.
"HighestCsrSeasonId": "guid"
I feel like this is an API bug as we shouldn't really be getting anything back other than a Guid or null. This third value of 'NonSeasonal' is unhandled.
Quote:
GET /stats/h5/servicerecords/arena?players=Omnickpotent HTTP/1.1
...
HighestCsrSeasonId=NonSeasonal
...
I'll have to write a custom converter to handle this case forcing the 'NonSeasonal' value to null instead. I don't see any other way around it. I'll have a chance to do this later today (~10 hours from now).

Thoughts?
  1. 1
  2. ...
  3. 2
  4. 3
  5. ...
  6. 4