Steam Achievements API - How to get achievement unlocking date?
Asked Answered
O

1

5

Is this possible to get achievement unlocking date in Steam Acheivements API? I have read a bunch of documentation, but found no mention of this.

Odiliaodille answered 12/5, 2014 at 14:55 Comment(0)
R
8

The answer to this is yes it is possible, but you have to use the old XML API, not the newer web API and it has to be a "newer" achievement.

The old style URL looks like this

http://steamcommunity.com/id/<profilename>/stats/<appid>/achievements/?xml=1

OR

http://steamcommunity.com/profiles/<profileid>/stats/<appid>/achievements/?xml=1

A couple notes at this point:

  • <profilename> is the unique URL name selected by the user. The <profileid> is the unique 64 bit number assigned by Valve
  • <appid> is the numerical app id. I assume you know how to find this, correct?

If you pull the XML from that link you end up with a structure that looks like this:

playerstats
  game
  player
  stats
  achievements
    achievement
      iconClosed
      iconOpened
      name
      apiname
      description
      unlockTimestamp

An important note: unlockTimestamp is not always available. Without digging into it to much, it appears this was added much later in the case of older games (ie. TF2). Thus, you have some of the original achievements that return data similar to this:

<achievement closed="1">
  <iconClosed>http://media.steampowered.com/steamcommunity/public/images/apps/440/tf_play_game_everyclass.jpg</iconClosed>
  <iconOpen>http://media.steampowered.com/steamcommunity/public/images/apps/440/tf_play_game_everyclass_bw.jpg</iconOpen>
  <name>Head of the Class</name>
  <apiname>tf_play_game_everyclass</apiname>
  <description>Play a complete round with every class.</description>
</achievement>

Versus newer achievements that look like this:

<achievement closed="1">
  <iconClosed>http://media.steampowered.com/steamcommunity/public/images/apps/440/bb590c7ca44dfc7eb6a31abb39fae07c47502ac7.jpg</iconClosed>
  <iconOpen>http://media.steampowered.com/steamcommunity/public/images/apps/440/4f244b30a76e9de5287a82cc3829c7930baa38c7.jpg</iconOpen>
  <name>Got A Light?</name>
  <apiname>tf_pyro_burn_spy_taunt</apiname>
  <description>Ignite an enemy Spy while he's flicking a cigarette.</description>
  <unlockTimestamp>1301887931</unlockTimestamp>
</achievement>

If a player hasn't earned an achievement yet, then the closed attribute on the achievement node will equal 0, and the returned data will look similar to the older achievements (without the unlockTimestamp)

<achievement closed="0">
  <iconClosed>http://media.steampowered.com/steamcommunity/public/images/apps/440/957daad8f6b9f237620e0326f38cbf941c60a9d1.jpg</iconClosed>
  <iconOpen>http://media.steampowered.com/steamcommunity/public/images/apps/440/34b787ce4e47ef0e206ecd52626b053da13e18c4.jpg</iconOpen>
  <name>Krazy Ivan</name>
  <apiname>tf_heavy_kill_underwater</apiname>
  <description>Kill 50 enemies while both you and your victim are underwater.</description>
</achievement>

In the above XML structure, the achievement node will repeat for each achievement that is available for the selected game.

Rutaceous answered 13/5, 2014 at 12:50 Comment(2)
Much thanks! But I found that not all of games supports old XML API and I have solved this problem by parsing HTML page with achievements.Odiliaodille
@Rutaceous Do you see some possibility to do it with the new Interface? Currently i get my Achievements with wiki.teamfortress.com/wiki/WebAPI/GetPlayerAchievements . But there is no unlockTimestamp :(Photocopy

© 2022 - 2024 — McMap. All rights reserved.