1. XenoPyax

    XenoPyax New Member

    XenoPyax
    MVP+
    Messages:
    3
    hey Hypixel'ers,

    I am trying to get all active auctions so I can sort them and save them but i dont seem to understand how I can get all the page ,with this method I am getting only 2 pages and the pageNumber is different everytime. Anyone that can help me with this I dont want to write my own API for this if I dont have to.
    Code:
        public static void startSkyBlockMarketUpdater() {
            marketTimer = new Timer();
            
            marketTimer.scheduleAtFixedRate(new TimerTask() {
                
                @Override
                public void run() {
                    Main.getHypixelAPI().getSkyBlockAuctions(0).whenComplete((a, b) -> {
                        //TODO: get Data an write to DB
                        JSONFile jsonFile = Main.getTempMarketFile();
                        
                        for(int page = 0; page < a.getTotalPages(); page++) {
                            Main.getHypixelAPI().getSkyBlockAuctions(page).whenComplete(Utility.getSkyBlockMarketConsumer());
                        }
                            
                        
                    });               
                }
            }, 0, 120*1000);
        }
     
    #1
  2. Auctions are constantly changing, and to avoid performance issues, the API keeps a local cache of auctions that is refreshed frequently (approximately once per second)
    There is various metadata available in a response. I would recommend sending a single request to the auctions endpoint, and then use the totalPages value from that response to request all those page requests simultaneously. If you want to play it safe, request a couple pages over the total pages count as well.
    {"success":true,"page":0,"totalPages":27,"totalAuctions":26971,"lastUpdated":1574812617907}
     
    #2
    • Like Like x 1

Share This Page