Does that work when there is no beacon name or guild alignment, or a mixture of both?
I havenāt actually tested it with guild alignment, but theoretically it should. Just found a bug in it by skimming through it though, could be more. Fixed it ofc.
edit: It should respect the string length, so if itās 0, the resulting beacon/guild name is just an empty string.
How are you instantiating the ArrayBuffer from the binary data? DataView complains that it requires an ArrayBuffer (which obviously it does) but ArrayBuffer requires a set length and the length of the response will vary and I donāt see any constructor that allows setting an ArrayBuffer based on binary.
Are you perhaps instantiating an ArrayBuffer with a length that is well beyond what is needed and then looping through and putting the api response in byte by byte?
I added an edit with a snipped how I do it in node.js, but itās a bit special since itās node.js so if youāre using something else itāll probably be different.
Itās a few posts above, here HTTP Shopping API Documentation
Iām building a new website for Portal Seekers and as part of it I wanted to have a little area to browse the shopping API. It wouldnāt be anywhere as detailed as what youāve already got for quite a while as Iām doing this part time in my free time, which I donāt have much of at present
Looks very professional! The more tools the merrier imo
For anyone wanting to do this in vanilla js, hereās how I accomplished (with a huge assist from Mayumichi):
function makeApiCall(url) {
let oReq = new XMLHttpRequest();
oReq.open("GET", url, true);
oReq.responseType = "arraybuffer";
oReq.onload = function (oEvent) {
let arrayBuffer = oReq.response;
if (arrayBuffer) {
let byteArray = new Uint8Array(arrayBuffer);
orders = parseShoppingApiResponse(byteArray);
}
};
oReq.send(null);
}
The variable āordersā is declared at a higher scope and thus accessible in the method.
Is there a list of item IDs out there somewhere somebody could share? Thanks
Luca gave us a list
This is an example script for processing the binary responses in Python:
I used it to dump and validate the output from the servers during development.
We donāt plan to offer a JSON response whilst the live game servers are returning the data - as we donāt want to risk stalling the game simulation. If we want JSON then weāll likely switch to a different architecture where the data is collated via another service. But the disadvantage of this would be that the Live servers and local Creative servers would then deliver different responses.
Would it be possible to clarify a few things on the Shopping API?
-
Regarding request limits - Is it 1 request per second, per API Key or is that per server (regardless of where the request comes from)?
1b. If per server, will there be anything in place to distribute requests fairly? -
With cached responses on live, will there be a header in the response to show the timestamp of the cache, so that we know how fresh the data is?
its 1 request per secondāish (strictly, 1 second since the server last responded to a shopping request, rather than since last received a request), and per server, not per API key. This is about preventing the shopping http api from being able to throttle the normal in-game requests as they share the same āresource poolā.
there is nothing to try and distribute across requestersā¦ I would hope there are not going to be so many competing users in the first place, but if it became a problem could do something about it then.
The desire to discourage use shows in the design.
I gather from some side conversations a little information about how the shop scanner is implemented into the server and can really only put it into context one way.
However this API is only minimally useful and itās set up in such a way that itās very restrictive and difficult to use, and canāt actually be relied upon to provide consistent, much less āreal timeā data.
So you have a situation where not many people are going to be interested in working with it, and there wonāt be really room for interactive applications or any sort of integration other than a minimal data logger thatās always running behind.
If more than one person attempts to integrate with this, itās going to be a problem.
the CDN cache layer should smooth that overā¦ the limit is in the server, not the cdn so you can only hit the limit if requesting uncached data; so there would be some small amount of fighting between multiple clients over which bit of uncached data is generated next, but once hit itd be cached for 30mins and next hits would just hit the cdn and get the cached data without hitting the rate limiting.
and the cdn does return an āageā header which is the number of seconds since the data was cached in the cdn.
I think thatās going to be quite difficult when any new app comes along and wants to initially populate itās own database with all the most up-to-date prices.
This news kinda blows my php implementation out of the water too. Iām going to have to move the requests to the front end now and delay showing data to a user.
(assuming there is an existing app already polling all this like crazy) then the new app comes along and almost all of its requests just hit the cdn and get the last cached data.
Just trying to test my understanding of the rate limiting and the cache.
- Each individual request get cached
ā I do a request for stands selling item x, gets cached for 30 mins
ā I do a request for baskets requesting x, gets its own 30 minute cache timer - If its in cache, you will always be served the cache data
- If itās not in cache and server is not on cooldown, you will get live data which is then cached
- If itās not in cache and server is on cooldown, what is the error response?
ā Response code?
ā Error message? - Do too many requests while server is on cooldown result in some kind of ban?
Did I get any of the above wrong?
Ah ok, not as much an issue as I assumed then.