Results 1 to 4 of 4

Thread: Batch requesting player information

  1. #1
    Fresh Spawn
    Join Date
    Oct 2016
    Posts
    7

    Batch requesting player information

    I know this may be something others have thought to try but I don't see anyone asking. Is there any way to batch request for players info? For example, right now I need to loop through every player I want info for and this is very inefficient. If this is not already a feature then please add it, otherwise, someone please correct me in my thinking.

  2. #2
    Fresh Spawn
    Join Date
    Sep 2018
    Posts
    2
    What kind of players info do you need?

  3. #3
    OnyxDS's Avatar
    Join Date
    Sep 2014
    Location
    Brexit Island
    Posts
    5,790
    I'm pretty sure you can't get batch info.

    And I'm not sure we're all that likely to get it added. It's looks to me like most of the API functions are pretty much links to functions the app itself uses - so the player info is basically the player profile screen that you see in game
    Forum cup organiser. The forum cup discord server is: https://discord.gg/KEUxV2e

  4. #4
    Trainee
    Join Date
    Nov 2017
    Location
    France
    Posts
    10
    Well, it's not how an API is meant to work

    An API provides elementary methods to access data, the loop (or "batch", as you named it) has to be made within your code.

    Code:
       $clan_json = get_json(....blah blah..#CLAN_TAG...);
       $clan = json_decode($clan_json);
       // HERE YOU HAVE A $clan OBJECT WITH ALL CLAN DATA
    
       // THEN YOU LOOP FOR EVERY CLAN MEMBERS
       foreach($clan->memberList as $member)   {
    
          $player_json = get_json(....blah blah..$member->tag...);
          $player = json_decode($player_json);
          // HERE YOU HAVE A $player OBJECT WITH ALL PLAYER DATA
    //ADD
    Well, i read to fast.. you probably already knew that.
    It's inefficient because making 50 requests takes time.. but it's not inefficient, it's.. normal.

    Best practice is to pre-load data (scheduled task for example) that you store locally, then you read those "pre-loaded" data.
    You surely don't want to launch 50 requests when a user wants to load a webpage, a discord bot command or whatever.
    Last edited by funkTLS; 3 Weeks Ago at 09:56 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •