Talk:WebAPI/Feedback

From Team Fortress Wiki
< Talk:WebAPI
Revision as of 16:17, 5 July 2010 by FireSlash (talk | contribs) (Things that should be added to the next version of GetSchema)
Jump to: navigation, search

Suggestions

Things that should be fixed in the Steam Web API system

  • JSON and VDF should use arrays rather than objects containing arrays. Having them structured differently from XML complicates code unnecessarily (and result.items.item[1] is redundant compared to results.items[1]). This seems to have been designed to preserve the element name used for the individual objects in XML (allowing multiple arrays to be defined in the event of mixed types, which should be structured as multiple arrays in XML as well). When everything in an array is of the same class, nobody in JSON cares about that class's name (only its index in the containing array, and anybody using VDF is using code that was written for the original data file, which is structured this way.

Short version: this

 "result": {
   "status": 1,
   "items": {
     "item": [
       {
         "id": 18446744073709019323,
         "defindex": 125,
         "level": 1,
         "quality": 3,
         "inventory": 2149580806,
         "quantity": 1
       },
       {
         "id": 1029705,
         "defindex": 36,
         "level": 5,
         "quality": 3,
         "inventory": 2147483655,
         "quantity": 1
       },
     ]
   }
 }

should look like this:

 "result": {
   "status": 1,
   "items": [
     {
       "id": 18446744073709019323,
       "defindex": 125,
       "level": 1,
       "quality": 3,
       "inventory": 2149580806,
       "quantity": 1
     },
     {
       "id": 1029705,
       "defindex": 36,
       "level": 5,
       "quality": 3,
       "inventory": 2147483655,
       "quantity": 1
     },
   ]
 }

--STUART 04:23, 5 July 2010 (UTC)

Methods that should be added to ITFItems_440

  • A method that returns all of a language's strings for a given language (like resource/tf_english.txt). This would allow simpler caching of GetSchema with regards to translation (clients would only need 1 GetSchema return for all languages, and could request each language individually without needing to get all of the schema data again, increasing the signal:noise ratio significantly for translation). --STUART 04:22, 5 July 2010 (UTC)
  • A method that returns the latest revision information for each of these, so systems know when they need to make the heavy call to GetSchema and other static methods. --STUART 04:22, 5 July 2010 (UTC)

Things that should be added to the next version of GetSchema

  • The revision number, so systems can compare it (for stored data) against the latest revision (as described above). --STUART 04:22, 5 July 2010 (UTC)
  • The defindex of attributes for items, rather than the attribute's name and class. If GetPlayerInventory uses defindex for its attributes, GetSchema should too. --STUART 04:22, 5 July 2010 (UTC)
  • Add missing fields used_by_classes and craft_class FireSlash 16:17, 5 July 2010 (UTC)

Things that should change in future versions of GetPlayerInventory

  • Ditch the "quantity" field. With a unique ID on the item, how can this be anything but 1? --STUART 04:22, 5 July 2010 (UTC)
  • Separate the "inventory" field into an "inventory_slot" value and "equipped" object (with a "true" for each class the item is equipped for, and empty if no classes have the item equipped). This is a Web API: consumers shouldn't have to do binary operations to parse it. --STUART 04:22, 5 July 2010 (UTC)

Problems

I'm still seeing "TF_Unique_Achievement_FireAxe1" returned from GetSchema with language=en defined. --STUART 03:50, 5 July 2010 (UTC)

Indeed. It seems to do this for every achievement-unlockable weapon.--RJackson 04:15, 5 July 2010 (UTC)