Talk:WebAPI/Feedback

From Team Fortress Wiki
< Talk:WebAPI
Revision as of 10:19, 28 July 2010 by SebBOT (talk | contribs) (auto: add languages template)
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)
  • A method that returns inventory images, or links to images. Currently the biggest hurdle of an update is digging all of the new data out of the tf2 gcfs. The three files at the moment are: items_game (partially covered by the GetSchema), tf_<lang> (Partially covered by GetSchema), and the backpack images (No solution). The images are also the most time consuming part. FireSlash 17:02, 5 July 2010 (UTC)
Biggest hurdle? Extract tf/materials/backpack and run it through VTFEdit's batch converter. Netshroud 23:27, 5 July 2010 (UTC)
As far as time consumption yes, since I also need tor resize and recompress images. items_game and tf_english are just a matter of extracting and uploading each file. Where in the images I have to sort through all the images in the gcf, dig out the new ones, extract convert resize and upload. If the images were available online, I could automate the process. FireSlash 00:58, 6 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)
  • Add a "timestamp" field, similar to the GetGoldenWrenches method. This would be useful for statistics and curiosity of users. --AltPluzF4 11:44, 10 July 2010 (UTC)

Problems

GetSchema

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)
You can use the information files tf2_<language>.txt to pull the names of the items based on the name provided. e.g. TF_Unique_Achievement_Shield in tf2_english.txt = "The Chargin' Targe". Not a perfect system, but it will give you the in-game names. These files are in orangebox/tf/resource (from the directory in which the 'steam' binary is located). I agree though, bit of a pain in some ways to have to use local data, but as I said, it ensures consistency between in-game and what you see outside of it if you do it that way Swixel 01:15, 9 July 2010 (UTC)
item_name now seems to be assigned the correct localised string, however "The" is excluded as well as the propername attribute. The addition of the propername attribute in the schema feed or just straight up prefixing "The" to the relevant names should solve the problem, propername is preferred however. Ath 21:27, 26 July 2010 (UTC)
This also happens with at least 1 attribute (#Attrib_Scattergun_NoReloadSingle) Lagg 23:14, 15 July 2010 (UTC)

The Dalokohs Bar buff attribute and Crit-o-Cola minicrit attribute have the same description token. Lagg 23:14, 15 July 2010 (UTC)

Despite it being easy enough to use "Hat" when printing the item_type_name for non-misc. headwear, I think we should have a string for TF_Wearable_Hat to be consistent. Lagg 03:02, 23 July 2010 (UTC)

GetGoldenWrenches

What appears to be Wrench #74 (itemID 103444671, has a timestamp between #73 and #75) is listed with a "wrenchNumber" value of 76. --STUART 21:54, 8 July 2010 (UTC)