Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

Dota 2 Match History WebAPI

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • can someone show me how to count win/lose/abandon stats of player?
    sorry for my bad English ...

    From Vietnam with Love - Lagest DOTA 2 Community in Vietnam: DotA-2.Vn

    Comment


    • As far as I know you can do that only by downloading every single game stats and counting the stats yourself, there is no summary API available

      Comment


      • I did the job of reading and compiling all the essential information from the past 180+ posts so that someone who just came by don't have to (he still has to read Zoid's opening post, of course). Feel free to duplicate this FAQ if necessary and call it v2 as I might not check this thread frequently.

        Direct link to this FAQ: http://dev.dota2.com/showthread.php?p=299634

        FAQ v1
        Q: How do I get my own API key?
        A: https://steamcommunity.com/dev/apikey

        Q: But I don't have a domain name to register a API key with. What can I do?
        A: Enter "zoid.is.awesome" in that field. Guaranteed to work.

        Q: Are there any rate limits on API calls?
        A: http://dev.dota2.com/showthread.php?p=289439

        Q: How do I get more than 25 results?
        A: Call the API with either "start_at_match_id" or "date_max" (e.g. https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?start_at_match_id=[1 less than the previous 25th match_id]&key=[YOUR STEAM API KEY])
        Note: As of the time of writing, there's an issue with start_at_match_id which prevents you from traversing past the first 500 results, so you would need to use date_max for now.

        Q: When will new features be implemented?
        A: Unlikely to be soon as the dev team is busy preparing for the upcoming International tournament.

        Q: How do I get details of private/bot/tournament/live matches?
        A: They're not available yet. See above.

        Q: Is there a dump of past matches?
        A: It's not available yet. See above.

        Q: Is there an API for heroes, items, cosmetics and inventory?
        A:
        Heroes: https://api.steampowered.com/IEconDota2_570/GetHeroes/v1/?language=en&key=[YOUR STEAM API KEY]
        Items: Nope, but this would suffice: http://dev.dota2.com/showthread.php?p=296787
        Cosmetics: https://api.steampowered.com/IEconItems_570/GetSchema/v1/?language=en&key=[YOUR STEAM API KEY]
        Inventory: https://api.steampowered.com/IEconItems_570/GetPlayerItems/v1/?language=en&key=[YOUR STEAM API KEY]&steamid=[STEAMID, STARTS WITH 765]

        Q: What does the value for * mean?
        A:
        lobby_type: 0 = Public matchmaking, 4 = Co-op bot
        player_slot: 0-4 = Radiant, 128-132 = Dire
        tower_status_*: http://dev.dota2.com/showthread.php?p=294180

        Q: Where can I get my SteamID?
        A: Add "?xml=1" to your Steam profile URL (e.g. https://steamcommunity.com/id/alesix?xml=1). Look for a long number that starts with 765 - that's your SteamID.

        Q: How do I convert between SteamID and account_id?
        A: SteamID - 76561197960265728 = account_id (for regular user accounts) OR take the low 32 bits of SteamID.

        Q: I'm too lazy to read. Can you answer my question "..."?
        A: Sure. You'll find your answer here: steam://uninstall/570
        Last edited by Alesix; 07-27-2012, 04:44 PM.

        Comment


        • thx ... still hard to collect player stats ...
          sorry for my bad English ...

          From Vietnam with Love - Lagest DOTA 2 Community in Vietnam: DotA-2.Vn

          Comment


          • Alesix' post should be quoted in OP
            Last edited by Shinkai; 07-27-2012, 02:20 AM. Reason: typo

            Comment


            • Originally posted by vtFurlin View Post
              IceHaku, top and mid tier 3 are missing from your example.

              And pls anyone know a free php server to do some testing? =)

              PS: Metroids, ty kind sir, I failed at my attempt at using the search.
              Just google "free php hosting" - you would find plenty out there.

              EDIT:
              I just tried zymic.com, seems pretty good so far. Not too sure whether it's ok with their terms to share account details, but anyway below is the FTP login for the account I created. (Anyone can use it, just don't do evil.)

              Host: dotaapi.zxq.net
              User: dotaapi_zxq
              Pass: pa55word

              Or enter this directly into an explorer window if you're on Windows:
              Code:
              ftp://dotaapi_zxq:[email protected]/


              Uploaded files and scripts can be accessed directly at http://dotaapi.zxq.net/[filename].
              Last edited by Alesix; 07-27-2012, 02:13 AM.

              Comment


              • Originally posted by Tsunami Nori View Post
                can someone show me how to count win/lose/abandon stats of player?
                it's easy to do
                first you have to get every single match the player has ever player

                <note this is just some rough code>


                while(true) {
                // try and get a match list
                /////////"https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?account_id=XXXXXXXXX&start_at_match_id=" . offset . "&matches_requested=25&key=XXXXXXXXXXX"

                // process the matches
                foreach (match) {
                // fetch the match_details page
                ////////"https://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/V001/?match_id=" . match->id . "&key=XXXXXXXXXX"

                /**
                * You have three choices here:
                * 1) either you can save all of the data and process it later
                * 2) or you can process it on the spot and discard the data
                * 3) or you can process the data now and store it for later
                *
                * If you intend on using this data again, I suggest you store it somehow!
                */
                }

                // if there are no results left, we can stop grabbing results
                if (match_list_json->results_remaining == 0) {
                break;
                // else we offset to the last match id and grab the next set of results
                } else {
                offset = matches[count(matches) - 1]->match_id;
                }
                }

                //if you chose to store the data without processing, this is when you'd process it
                Last edited by MuppetMaster42; 07-27-2012, 04:01 AM.
                The API Bible: Things You Should Know Before Starting API Development

                Comment


                • Originally posted by MuppetMaster42 View Post
                  it's easy to do
                  first you have to get every single match the player has ever player

                  see the attached file for how I do it. <note this is just some rough php code i wrote from memory, it is untested and blah blah>


                  i will try it ... thank you
                  sorry for my bad English ...

                  From Vietnam with Love - Lagest DOTA 2 Community in Vietnam: DotA-2.Vn

                  Comment


                  • I updated my earlier post with the new item icons and a small change to the getIcon function: http://dev.dota2.com/showthread.php?p=296787.

                    Comment


                    • Originally posted by Alesix View Post
                      Just google "free php hosting" - you would find plenty out there.
                      Right now I'm trying some things in flash so I don't need to look for a server, but ty.
                      Will give it a try later, my problem was that many of these free sites don't allow Brazilians to create accounts :S

                      Edit: Is there a difference between XML and JSON? Will any of the two return the data faster (from Valve's side)?
                      For me it looks like JSON has less useless data and therefor is faster, anyone confirm?
                      Last edited by vtFurlin; 07-27-2012, 06:20 AM.

                      Comment


                      • Originally posted by vtFurlin View Post
                        Edit: Is there a difference between XML and JSON? Will any of the two return the data faster (from Valve's side)?
                        Generally, you will have a better experience with JSON. There is less spare data in the files, therefore less data to get from the server. I also find JSON much easier to work with compared to XML.

                        Comment


                        • Originally posted by Lazze View Post
                          I updated my earlier post with the new item icons and a small change to the getIcon function: http://dev.dota2.com/showthread.php?p=296787.
                          It seems that the zip no longer contains the json file.

                          Comment


                          • I'm trying to figure out a way to search for a player name, and have it tell me the different user accounts with that user name. I know I could do this by iteration, but I would rather not slam the server with 20 requests (500 games) and search the account numbers for each of those games. Is there an API call for getting account numbers with the same user name?

                            Comment


                            • And pls anyone know a free php server to do some testing? =)
                              xampp is quite good for self-hosted coding environment, I use it personally while 'complete' code gets hosted on actual server. Quite easy to setup + manage

                              Comment


                              • How to convert to AccountID exactly?

                                Hey guys,

                                Im still a bit confused how to to convert from SteamID to Account ID.

                                For Example, this is my SteamID

                                http://steamcommunity.com/profiles/76561197969130713
                                OR
                                STEAM_0:1:4432492

                                What do I have to do to end up with this Account # 31609526 ??

                                Thanks in Advanced.

                                Comment

                                Working...
                                X