Jump to content
McKay Development

Recommended Posts

Posted

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
}

}

 

Posted
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.

Posted
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 ?
 

Posted
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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...