SENPAY98K Posted November 8, 2022 Report Posted November 8, 2022 Hello, I use for this api to fetch steam inventories: Quote http://steamcommunity.com/profiles/${steamID64}/inventory/json/753/6 The result has: Quote .."more": true, "more_start": 2000 Is there any parameter to load next pages ? Quote
Dr. McKay Posted November 9, 2022 Report Posted November 9, 2022 Off the top of my head, use start_assetid I think. Quote
PonyExpress Posted November 9, 2022 Report Posted November 9, 2022 Please advise if I use both methods to get inventory (old and new endpoints). Am I getting startId/startPos correctly? (to continue getting inventory in another way if need) pos = 1 function getItems(inventory, currency, startId, startPos) { // startId - assetid for new endpoint // startPos - pos for old endpoint // ... getting items using the old or new endpoint ... // if used new endpoint: if (body.more_items) { getItems(inventory, currency, body.last_assetid, startPos + body.assets.length) // or startPos should be +/- 1? return } // if used old endpoint: if (body.more) { pos = pos + Object.keys(body.rgInventory).length + Object.keys(body.rgCurrency).length let lastAssetid = Object.keys(body.rgInventory)[Object.keys(body.rgInventory).length - 1] || Object.keys(body.rgCurrency)[Object.keys(body.rgCurrency).length - 1] // this is the last received Assetid? getItems(inventory, currency, lastAssetid, body.more_start) return } } Quote
Dr. McKay Posted November 9, 2022 Report Posted November 9, 2022 The new endpoint has last_assetid, which you should pass as start_assetid for the next request. Quote
PonyExpress Posted November 9, 2022 Report Posted November 9, 2022 1 hour ago, Dr. McKay said: The new endpoint has last_assetid, which you should pass as start_assetid for the next request. Yes. But I wanted to know what should I do If my next request will use Old endpoint :) (After use new endpoint) In my case I am using the new endpoint until error 429 happens, after that I use the old endpoint. Quote
SENPAY98K Posted November 9, 2022 Author Report Posted November 9, 2022 4 hours ago, PonyExpress said: pos = 1 function getItems(inventory, currency, startId, startPos) { // startId - assetid for new endpoint // startPos - pos for old endpoint // ... getting items using the old or new endpoint ... // if used new endpoint: if (body.more_items) { getItems(inventory, currency, body.last_assetid, startPos + body.assets.length) // or startPos should be +/- 1? return } // if used old endpoint: if (body.more) { pos = pos + Object.keys(body.rgInventory).length + Object.keys(body.rgCurrency).length let lastAssetid = Object.keys(body.rgInventory)[Object.keys(body.rgInventory).length - 1] || Object.keys(body.rgCurrency)[Object.keys(body.rgCurrency).length - 1] // this is the last received Assetid? getItems(inventory, currency, lastAssetid, body.more_start) return } } What is the paramater you use in old api ? Quote
SpacePumpkin Posted November 13, 2022 Report Posted November 13, 2022 On 11/9/2022 at 6:43 PM, SENPAY98K said: What is the paramater you use in old api ? Have you noticed that the ratelimits are different for these calls? We're currently facing very aggressive ratelimiting on the new api so it would be nice to have a backup thats on a different ratelimit system Quote
SENPAY98K Posted November 13, 2022 Author Report Posted November 13, 2022 4 hours ago, SpacePumpkin said: Have you noticed that the ratelimits are different for these calls? We're currently facing very aggressive ratelimiting on the new api so it would be nice to have a backup thats on a different ratelimit system Yesim aware of that recent change, now im looking into at this old api to use: https://steamcommunity.com/tradeoffer/new/partnerinventory Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.