API Feature Request - Getting complete object mappings on API example and Try it Page

API Discussion
I am new to the Blizzard API and I am attempting to create complete POCO objects from the JSON objects provided from the Blizzard API in my C# application. However, as I was working with these objects I discovered that the return results are not representing a complete POCO object from the API when using the “Try It” feature. Overall the "Try It" feature works very well. What would add a great deal more mileage would be to have a viewable version of the complete object in JSON that can be consumed as an example.

Here is my use case example using /wow/achievement/:id from the Achievement API call for World of Warcraft.

***First setup***
Region: us
Id: 2144
Locale: en_US
Click “Try It”

***The resulting JSON string was returned:
{
"id": 2144,
"title": "What a Long, Strange Trip It's Been",
"points": 50,
"description": "Complete the world events achievements listed below.",
"reward": "Rewards: Violet Proto-Drake",
"rewardItems": [
{
"id": 44177,
"name": "Reins of the Violet Proto-Drake",
"icon": "ability_mount_drake_proto",
"quality": 4,
"itemLevel": 70,
"tooltipParams": {
"timewalkerLevel": 0,
"azeritePower0": 0,
"azeritePower1": 0,
"azeritePower2": 0,
"azeritePower3": 0,
"azeritePowerLevel": 0
},
"stats": [],
"armor": 0,
"context": "",
"bonusLists": [],
"artifactId": 0,
"displayInfoId": 0,
"artifactAppearanceId": 0,
"artifactTraits": [],
"relics": [],
"appearance": {}
}
],
"icon": "achievement_bg_masterofallbgs",
"criteria": [
{
"id": 7553,
"description": "To Honor One's Elders",
"orderIndex": 0,
"max": 1
},
{
"id": 7561,
"description": "Fool For Love",
"orderIndex": 1,
"max": 1
},
{
"id": 9880,
"description": "Noble Gardener",
"orderIndex": 2,
"max": 1
},
{
"id": 7555,
"description": "For The Children",
"orderIndex": 3,
"max": 1
},
{
"id": 0,
"description": "The Flame Warden/Keeper",
"orderIndex": 4,
"max": 1
},
{
"id": 7564,
"description": "Brewmaster",
"orderIndex": 5,
"max": 1
},
{
"id": 7558,
"description": "Hallowed Be Thy Name",
"orderIndex": 6,
"max": 1
},
{
"id": 7566,
"description": "Merrymaker",
"orderIndex": 7,
"max": 1
}
],
"accountWide": true,
"factionId": 2
}

***Second Setup***
Region: us
Id: 2140
Locale: en_US
Click “Try It”

***The resulting JSON string was returned:
{
"id": 2140,
"title": "Momma Said Knock You Out (25 player)",
"points": 10,
"description": "Defeat Grand Widow Faerlina in Naxxramas without dispelling or preventing frenzy in 25-player mode.",
"rewardItems": [],
"icon": "spell_shadow_curseofmannoroth",
"criteria": [
{
"id": 7549,
"description": "Defeat Grand Widow Faerlina without dispelling or preventing frenzy.",
"orderIndex": 1,
"max": 1
}
],
"accountWide": false,
"factionId": 2
}

When converting the two objects to C# POCOs the following occurred.
First looking at object id 2140. This object when converted using http://json2csharp.com it returned two class models listed below.

public class Criterion
{
public int id { get; set; }
public string description { get; set; }
public int orderIndex { get; set; }
public int max { get; set; }
}

public class RootObject
{
public int id { get; set; }
public string title { get; set; }
public int points { get; set; }
public string description { get; set; }
public List<object> rewardItems { get; set; }
public string icon { get; set; }
public List<Criterion> criteria { get; set; }
public bool accountWide { get; set; }
public int factionId { get; set; }
}

As I reviewed the two models I noticed that “rewardItems” was a “List<object> and did not have a POCO description for the collection.

Next taking a look at object id 2144 which was also converted using the http://json2csharp.com tool. This one returned a great deal more as there was more content in the JSON string blob.

public class TooltipParams
{
public int timewalkerLevel { get; set; }
public int azeritePower0 { get; set; }
public int azeritePower1 { get; set; }
public int azeritePower2 { get; set; }
public int azeritePower3 { get; set; }
public int azeritePowerLevel { get; set; }
}

public class Appearance
{
}

public class RewardItem
{
public int id { get; set; }
public string name { get; set; }
public string icon { get; set; }
public int quality { get; set; }
public int itemLevel { get; set; }
public TooltipParams tooltipParams { get; set; }
public List<object> stats { get; set; }
public int armor { get; set; }
public string context { get; set; }
public List<object> bonusLists { get; set; }
public int artifactId { get; set; }
public int displayInfoId { get; set; }
public int artifactAppearanceId { get; set; }
public List<object> artifactTraits { get; set; }
public List<object> relics { get; set; }
public Appearance appearance { get; set; }
}

public class Criterion
{
public int id { get; set; }
public string description { get; set; }
public int orderIndex { get; set; }
public int max { get; set; }
}

public class RootObject
{
public int id { get; set; }
public string title { get; set; }
public int points { get; set; }
public string description { get; set; }
public string reward { get; set; }
public List<RewardItem> rewardItems { get; set; }
public string icon { get; set; }
public List<Criterion> criteria { get; set; }
public bool accountWide { get; set; }
public int factionId { get; set; }
}

In this case the “rewardItems” List<RewardItem> contained a definition for the previously anonymous object class. However, other class model members also contained only the generic “object” in this case found in the model “RewardItem” for “stats”, “bonusList”, “artifactTraits”, and lastly “relics”. Additionally, it also listed an empty class “Appearance” which contained no class properties but was referenced in the “RewardItem” model.

Having the full POCO model for each of these would be immensely helpful and the feature enhancement request that I am making for the APIs is to have a static JSON string that shows the full model with values, even if the values are example / dummy values. This would be very similar to how “Swagger” works with a C# API live tests similar to what you have created for testing the API calls. Example: https://kb7ppbapi.azurewebsites.net/swagger/ui/index#!/Status/Status_GetAsync
I hope that this feature could be considered and hopefully added / implemented to aid in the consumption of the APIs.

Thanks again Blizzard Dev Team!

Join the Conversation

Return to Forum