Jump to content


General Discussion of Wargaming Public API


  • Please log in to reply
741 replies to this topic

Hedeone #1 Posted 23 December 2013 - 03:50 PM

    Sergeant

  • Developer
  • 1 battle
  • 232
  • Member since:
    09-17-2013

Topic for general discussion of using Wargaming Public API.

 

With Bug reports and Suggestions to improvement please create ticket in Customer Service Center ( https://eu.wargaming.net/support/ ), category "Wargaming Public API".



Darkmoore #2 Posted 23 December 2013 - 07:57 PM

    Private

  • Player
  • 6560 battles
  • 3
  • [ITGAI] ITGAI
  • Member since:
    08-25-2012

Heyho,

 

for you experienced developers it might sound ridiculous, but im a beginner with Java and just want to add e.g. someone's Kill-Death-Ratio into some HTML-Code. Can you give me a simple Code for this?

 

Thanks  :eyesup:



StormimOn #3 Posted 23 December 2013 - 10:07 PM

    Staff Sergeant

  • Beta Tester
  • 18760 battles
  • 460
  • Member since:
    10-04-2010

Hello,

 

Looks really interesting and I've got a first question.

 

I already use the API 2.0 for an application in the french community (but it's english localized too).

I'm going to launch the new version for the new year, using API 2.0. It was running smoothly until getting players tanks list became really slow, took probably time server side to prepare the data. And I did get lots of 502 / 504 errors, since I was using multiple tasks for updating clans I suppose there is some limitation in the number of concurrent HTTP requests (and maybe others limitations). So I did revert back some of my work for the moment.

 

By adding my application in this program I can get official support about the API of course, but is there something else ?


Edited by StormimOn, 23 December 2013 - 10:09 PM.


Hedeone #4 Posted 24 December 2013 - 07:38 AM

    Sergeant

  • Developer
  • 1 battle
  • 232
  • Member since:
    09-17-2013

View PostStormimOn, on 23 December 2013 - 09:07 PM, said:

Hello,

 

Looks really interesting and I've got a first question.

 

I already use the API 2.0 for an application in the french community (but it's english localized too).

I'm going to launch the new version for the new year, using API 2.0. It was running smoothly until getting players tanks list became really slow, took probably time server side to prepare the data. And I did get lots of 502 / 504 errors, since I was using multiple tasks for updating clans I suppose there is some limitation in the number of concurrent HTTP requests (and maybe others limitations). So I did revert back some of my work for the moment.

 

By adding my application in this program I can get official support about the API of course, but is there something else ?

Hello, each application_id have a quotas for request per second:
5 requests per second for stand-alone application_id
10 requests per second for server application_id
More about types of application_id you can find in documentation: https://eu.wargaming.net/developers/documentation/guide/principles/

 

If you need to extend this quotas, you can mail to dev.support@wargaming.net or create support ticket in https://eu.wargaming.net/support with description of your project and reasons why do you need extend standard quotas. All such cases are considered in private order.



MiChAeLoKGB #5 Posted 26 December 2013 - 01:22 AM

    Corporal

  • Player
  • 8986 battles
  • 136
  • Member since:
    04-14-2012

Hi,

 

Im working on personal web tech tree (ie.: I can set my id in administration and users will see my tech tree), and I noticed, that in_garage function has Warning, that it will be disabled.

Could you tell me why? Will there be replacement?

If its cos security reasons, what about adding some token or something like that to URL, and with it I would be able to get which tanks are in garage and which are not?

 

Also, it returns only tanks player has played with, so If I unlocked some tank, but never played it (free XP trought it) it doesnt post it (so my tech tree shows it as never played). Will this be fixed? Im sure there is a way to find tanks user has researched. Cos if not, then I can delete my whole code, cos its useless :sad:

 

 

Btw.: what about adding there Price of tank? I mean Gold/Credits and XP. Cos I really dont want to do hundreds of requests to get price for every tank (or at least add it to your DB Dumps with tanks list, that would be much faster (I dont care about sales, just want regular price there)).

 

Thank you for your response.


Edited by MiChAeLoKGB, 26 December 2013 - 03:13 PM.


Terradine #6 Posted 26 December 2013 - 06:42 AM

    Private

  • Developer
  • 5 battles
  • 3
  • Member since:
    11-19-2013

View PostMiChAeLoKGB, on 26 December 2013 - 01:22 AM, said:

Hi,

 

Im working on personal web tech tree (ie.: I can set my id in administration and users will see my tech tree), and I noticed, that in_garage function has Warning, that it will be disabled.

Could you tell me why? Will there be replacement?

If its cos security reasons, what about adding some token or something like that to URL, and with it I would be able to get which tanks are in garage and which are not?

 

Also, it returns only tanks player has played with, so If I unlocked some tank, but never played it (free XP trought it) it doesnt post it (so my tech tree shows it as never played). Will this be fixed? Im sure there is a way to find tanks user has researched. Cos if not, then I can delete my whole code, cos its useless :sad:

 

 

Btw.: what about adding there Price of tank? I mean Gold/Credits and XP. Cos I really dont want to do hundreds of requests to get price for every tank.

 

Thank you for your response.

 

Some methods are to be closed and changed because of optimization. We try to make methods more universal, more fast, more useful in order to help API users work and create their products more efficiently



Lector #7 Posted 26 December 2013 - 10:37 PM

    Second Lieutenant

  • Beta Tester
  • 3734 battles
  • 1,022
  • [22KT] 22KT
  • Member since:
    12-18-2010

Hello!
Also look forward to the inclusion of information in_garage.
Currently
building the statistics page of my games.
And to be completely happy you need me just in_garage information.

The next thing I would like to see the integration of the information for vehicles: spotted, hits, battle_avg_xp, draws, losses, shots, xp, frags, survived_battles, max_xp.

 

And here is currently what I have done.

http://lector.wot-stat.tk/ - The Polish

The work goes slowly: (


Edited by Lector, 28 December 2013 - 11:39 AM.


MiChAeLoKGB #8 Posted 26 December 2013 - 11:35 PM

    Corporal

  • Player
  • 8986 battles
  • 136
  • Member since:
    04-14-2012

Thats some really nice piece of work. I might get some inspiration from it :blinky:

 

I tried to do my list as a Tech-Tree, but there are couple of problems.

First: you dont know in which lane certain tank is, then, you dont know which position in that lane tank has, and also you dont know, if tank has been researched.

The first 2 problems are the biggest one, cos there is no solution to create Tech tree with one function. Only option is to have my code 200x longer, and manualy position every tank where it should be and I really WONT do this. :ohmy:

 

Cos now my function draws all tanks from DB and checks if you played it or not, if yes, its highlighted.

 

 

If somebody has some idea how to do it more easily, than have like 1500 lines of code, I would be really glad.

Only way I think it could work is, to create whole design of tech tree, and then just compare if this tank is allowed to be in that spot, if yes, show it there, if not, look for another. But that would put tons of presure to DB, and also code would be longer (now I have one function, so I can just call function_name(nation, class); and thats all. Yeah and Im using PHP.

 

But I think Im bit OT right now, and that maybe should be in new topic.

 

 

Anyway.: Add (or fix and dont delete) in_garage and is_researched to players tanks list. That would make me happy. Even better would be something like in_line and in_position to get tanks line and position in that line in tech tree. But I think thats too much to ask you for.


Edited by MiChAeLoKGB, 26 December 2013 - 11:39 PM.


Lector #9 Posted 27 December 2013 - 10:58 AM

    Second Lieutenant

  • Beta Tester
  • 3734 battles
  • 1,022
  • [22KT] 22KT
  • Member since:
    12-18-2010

UP

I would suggest to get at the files of the game with techtree or converting some fashion on the tree vertical. There have recorded how the place of the vehicle.

-----

When the Mk. VIC - Christmas bonus in the API?


Edited by Lector, 27 December 2013 - 11:00 AM.


Hedeone #10 Posted 27 December 2013 - 11:42 AM

    Sergeant

  • Developer
  • 1 battle
  • 232
  • Member since:
    09-17-2013

View PostMiChAeLoKGB, on 26 December 2013 - 10:35 PM, said:

Anyway.: Add (or fix and dont delete) in_garage and is_researched to players tanks list. That would make me happy. Even better would be something like in_line and in_position to get tanks line and position in that line in tech tree. But I think thats too much to ask you for.

Field in_garage is in development and will be released in future updates of API.
We have plans to add parent and child tanks fields, but at this moment we can't tell when it will be released.

View PostLector, on 27 December 2013 - 09:58 AM, said:

When the Mk. VIC - Christmas bonus in the API?

Mk. VIC and VK.72.01 (K) will be added to API soon.



Cezikos #11 Posted 27 December 2013 - 12:59 PM

    Private

  • Beta Tester
  • 12629 battles
  • 27
  • [-LPG-] -LPG-
  • Member since:
    10-31-2010
What is difference between 'account_id' and 'id' in 'LIST OF PLAYERS' ?
Value is the same to both.

Edited by Cezikos, 27 December 2013 - 01:01 PM.


Unknown0ne #12 Posted 27 December 2013 - 01:55 PM

    Corporal

  • Beta Tester
  • 0 battles
  • 114
  • Member since:
    07-28-2010

I'm working on a server application and want to use the API to authenticate users. After looking over the Authentication section of the API documentation, I've come to the conclusion the following process should work:

 

  1. Redirect users to the OpenID login api URI with the redirect_uri set to redirect back to my site.
  2. The user logs in with their WG account and is redirected back to my site.
  3. My site would then take the returned access_token and send an extension request via the API (to verify the access token is valid, and that the provided account ID is actually associated with the access token).
  4. Upon a valid reply, the user would then be authenticated.

 

My question is: Is this the best way of going about this process? Sending the extension request seems a bit convoluted, but it's the only way I can think of to ensure someone doesn't simply send forged login data to redirect_uri and thus gain access to another user's account on my site.

 



MiChAeLoKGB #13 Posted 27 December 2013 - 07:08 PM

    Corporal

  • Player
  • 8986 battles
  • 136
  • Member since:
    04-14-2012

Download LightOpenID and that will do it for you, so you dont have to write almost any code.

 

Piece of code at login page (Im also requesting their WG name (namePerson/friendly), to save it as Username there):

 

Block Quote

            $openid = new LightOpenID('YOUR_DOMAIN');
            if(!$openid->mode) {
                if(isset($_POST['openid_identifier'])) {
                    $openid->identity = $_POST['openid_identifier'];
                    $openid->optional = array('namePerson/friendly');
                    header('Location: ' . $openid->authUrl());
                }

 

                //LOGIN BUTTON (form method post bla bla, you know)

 

            } elseif($openid->mode == 'cancel') {

                // Cancel authentification message

            } else {

                //User is authentificated, what should I do now, my master?

            }

 


Edited by MiChAeLoKGB, 27 December 2013 - 07:09 PM.


s2k11 #14 Posted 27 December 2013 - 10:57 PM

    Lance-corporal

  • Player
  • 17614 battles
  • 60
  • [STUHL] STUHL
  • Member since:
    07-30-2011

You don't have HTML in your example but your comments are telling me, you are mixing it together with PHP. Please, please don't. :sad:

 

But yeah, there are many OpenID libs out there no need to invend a new wheel. I've modified mine, so I'm not sure which lib I'm using. I think it was lightOpenID, too.

 

Block Quote

    public function user_call_login($args)
        {
            $szRegion = 'eu';
            if(isset($args[0]))
                {
                    switch($args[0]) {
                        case 'eu': $szRegion = 'eu'; break;
                        case 'ru': $szRegion = 'ru'; break;
                        case 'na': $szRegion = 'na'; break;
                        case 'sea': $szRegion = 'asia'; break;
                    }
                }

            $oOpenID = new App_OpenId(App_Core::getHost());
            if(!$oOpenID->mode)
                {
                    $oOpenID->identity = sprintf('https://%s.wargaming.net/id/', $szRegion);
                    $oOpenID->returnUrl = $oOpenID->realm . $_SERVER['REQUEST_URI'];
                    header('Location: ' . $oOpenID->authUrl());
                    $this->addNotice('Auth sent!');
                }
            elseif($oOpenID->mode == 'cancel')
                $this->addNotice('Auth canceled!');
            else
                if($oOpenID->validate())
                    {
                        $vParsed = App_Core::parseWargamingID($oOpenID->identity);
                        $this->addMessage($vParsed['userid'] . ' has logged in!');
                        $vUserData = explode('-', $vParsed['userid']);
                        App_User::getInstance()->login($vUserData[1], $vUserData[0]);
                    }
                else
                    $this->addError($oOpenID->identity . ' failed to login!');
            return $this->redirect($this, 'index');
        }

 Here you got another view. Looks familiar, but there are also some commands for my framework in it. I hope I'm not confusing somebody :D

But remember the EULA, inform the user which data you are collecting ;)



blaah #15 Posted 27 December 2013 - 11:32 PM

    Private

  • Clan Diplomat
  • 24930 battles
  • 38
  • Member since:
    01-28-2012

View PostMiChAeLoKGB, on 26 December 2013 - 01:22 AM, said:

Btw.: what about adding there Price of tank? I mean Gold/Credits and XP.

 

Thank you for your response.

You can get some info from tank details, requesting the data for each tank:

https://eu.wargaming...pedia/tankinfo/

 

Gold price and credits price seems to be working, but the XP needed is set to 0.

I suggest you make your own table with tanks and only request info about new ones if needed.

 

I will be implementing techtrees soon as well and I guess I'm gonna do it the same way I did it in past - create them manually :)
I doubt they are rendered automatically in WoT.

 

View PostLector, on 26 December 2013 - 10:37 PM, said:

I would like to see the integration of the information for vehicles: spotted, hits, battle_avg_xp, draws, losses, shots, xp, frags, survived_battles, max_xp.

 

That would be pretty nice, we would be able to calculate stats for each tank :smile:

 

Unknown0ne, like the other people said, the easiest way is to use an existing OpenID library. I also use LightOpenID and it works just fine :)

Btw. are you the Unknown0ne from NA server?

 


Edited by blaah, 27 December 2013 - 11:43 PM.


Ghost199 #16 Posted 28 December 2013 - 12:40 AM

    Private

  • Player
  • 6614 battles
  • 2
  • Member since:
    07-26-2011

can somebody help on how to change account details like exp of credits or kd everytime i try the post method it does not work

 

please send me a pm



blaah #17 Posted 28 December 2013 - 01:57 AM

    Private

  • Clan Diplomat
  • 24930 battles
  • 38
  • Member since:
    01-28-2012

What are you trying to do?

 

API provides methods to READ data not to change them.



s2k11 #18 Posted 28 December 2013 - 02:18 AM

    Lance-corporal

  • Player
  • 17614 battles
  • 60
  • [STUHL] STUHL
  • Member since:
    07-30-2011

Well, he could store the data and change it locally :D

Maybe he want to filter those fields? In this case simply fill the field 'fields' with all the fieldnames you want to gather, seperated by a comma.

For example [...]?application_id=demo&fields=statistics.all.xp,private.credits[...] etc.



Lector #19 Posted 28 December 2013 - 02:19 PM

    Second Lieutenant

  • Beta Tester
  • 3734 battles
  • 1,022
  • [22KT] 22KT
  • Member since:
    12-18-2010

Is Personal Rating will be available in the API?
Because from what I saw in the formula given in patch 0.8.9 data are needed before the patch, which is unlikely to have access.

 

View PostHedeone, on 27 December 2013 - 11:42 AM, said:

Field in_garage is in development and will be released in future updates of API.
We have plans to add parent and child tanks fields, but at this moment we can't tell when it will be released.

Mk. VIC and VK.72.01 (K) will be added to API soon.

And it can not be added on the occasion of adding Japanese vehicles?
But probably it was clear from it will be given a gift.

Adding the entire Japanese tree took you near a few hours, and you have not added a single tank for 3 days.


Edited by Lector, 28 December 2013 - 02:21 PM.


Hedeone #20 Posted 28 December 2013 - 02:59 PM

    Sergeant

  • Developer
  • 1 battle
  • 232
  • Member since:
    09-17-2013

View PostLector, on 28 December 2013 - 01:19 PM, said:

Is Personal Rating will be available in the API?
Because from what I saw in the formula given in patch 0.8.9 data are needed before the patch, which is unlikely to have access.

And it can not be added on the occasion of adding Japanese vehicles?
But probably it was clear from it will be given a gift.
Adding the entire Japanese tree took you near a few hours, and you have not added a single tank for 3 days.

1. Yes, Personal Rating will be available in future updates of Wargaming API.

2. In encyclopedia methods we are dependent on World of Tanks official portal. When this tanks (Mk. VIC and VK.72.01 (K)) will appear in Tankopedia, we will add them to API.






1 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users