HTTP Shopping API Documentation

Let me check why the Testing client is reporting a version issue.

1 Like

Latest release on Testing should work now.

3 Likes

I can confirm that it works now.

Alright, I have spent some more time trying to flush things out and I have found the following:

  • Beacon Size & Name decoded perfectly fine
  • Guild Tag Size & name decoded perfectly fine
  • The Buy From and Sell To appears to be swapped. That is Buy From lists Request Baskets and Sell To lists Shop Stands
  • When I extract the price that doesnā€™t seem to math out. For request basket buying at 250/275 the price comes back as 25,000. The quantity is accurate for the amount I have in there though. For the shop stand selling at 500/475 the price is 50,000 even though the quantity is 16
  • Location X appears to be the E/W value and is spot on
  • Location Z appears to be N/S but is inverted. It shows me 1075 when the game client shows me -1075
  • Location Y appears to be spot on.

I have now attempted to separate approaching to decode this. One uses a manual navigation of byte array and the second loading the byte array into a memory stream and reading through it progressively. They both net the exact same values.

if you compared against the player dui window, youā€™d see the z in there is opposite the N/S as well (for whatever ancient reason, the normal user-facing gui inverts the z, who knows whyā€¦), its accurate.

the price returned by the api is the raw price pre-tax, and integer units of cents (1 coin = 100 cents), its not multiplied by the item count or anything.

as James specified in the OP, B is for request Baskets (internally, buying_plinths), S is for Shop Stands (internally, selling_plinths)

2 Likes

Thanks for the clarification! I formed a mental block of B for Buy and S for sell lol. I can confirm it works as intended across the board. Thanks.

Does this mean that the response is fresh every time, no server side caching? I notice thereā€™s an ETag, I assume this means I should provide the If-None-Match header in the requests.

Thereā€™s also some items which arenā€™t visible in the knowledge but still have a response, is there a way to know which items are queryable? The compileditems.msgpack doesnā€™t seem to help here, and an invalid item id gives an empty response, just like a valid item with no active orders.

I have some trouble getting the item list length to match that :smiley:

i based that 1114 on everything that ā€œcan be in the knowledge screenā€ which isnt really known server side per-sayā€¦ so server just responds with an empty valid response as it doesnt care if its ā€œallowed in a plinth or notā€.

based on the compiledmsgpackā€¦ itll roughly (except for tokens) be anything that is ā€œcanDevGiveā€ā€¦ excluding anything that ā€œcant be got in gameā€ (a bit complexā€¦) but largely means ā€œhas no recipeā€ as there are some items that exist in the game/are valid/usable etcā€¦ but not possible to get in game as does not occur naturally and has no recipes etc (items designers added but at the last minute decided not to use, some brews fall into this category)

I could give you a dump of the itemids tomorrow if you remind me in a PM.

1 Like

This doesnā€™t seem to be the case, at least the server responds with the data when querying faster. Is the creative server different with the rate limiting than itā€™ll be on live? Trying to find out if I can schedule the next request 1 second after the previous one was initiated, or 1 second after I received the response.

At 1 second intervals and 1200 items itā€™d take 20 minutes to go through the list, should I not live on the edge and increase the delay a bit or is it safe to hammer it every second?

Independently of rate limits all items arenā€™t equal. Many items are infrequently traded.

Bucket items into (often/infrequently) (bought/sold). Then make fewer requests. But prioritise the more liquid items.

Does that mean 1 request per second is too much? Iā€™ll ofc prioritise the more liquid items, but I still need to set a safe max rate for the backend. Iā€™m only wondering because the server isnā€™t kicking any requests back even at a much higher rate.

edit: Also realised that separate buy/sell requests double the amount, so low priority items could see updates pretty infrequently even at 1/sec rates.

1 Like

I was leaving @lucadeltodecso to respond about the limiting - as Iā€™m not sure what is setup.

1 Like

Hey I donā€™t know anything about scripting. But I was just wondering if you build something in creative. Can you use coordinates to copy and paste parts of your builds?
Ie. walls/towers etc.

This is something that you could do in a script. But the script would need to be created.

So technically yes - but some work required before non-technical folks can do it easily.

1 Like

Thats cool. I wish I knew more about scripting.
Iā€™m pretty sure the pc minecraft had a way of doing this. Unless it was a mod. Either way if it was the same language it might be a good idea to see how they did it. Even if itā€™s not the same language there might be similarities that could be reworked to do this.

Are copy and paste functions that exist in the scripts or do they also have to be created as well?
If they were then youā€™d be looking at how to select something to be copied.
Which I think would be something like select coordinates from x y z(also starting point for paste) to x y z.
Then select x y z coordinates for paste.
Iā€™m sure itā€™s not that easy. But you know throw a few ones and zeros in there and some symbols and bingo bango. Copy paste. Lol. Btw one day Iā€™d love to see this in live game. Blueprints James. Then you can start making the billions! :stuck_out_tongue_winking_eye:

this is the list of all items that should be possible to ever have in a shopping plinth, noting it also contains the ā€œcheatā€ items normally impossible to get (you may want to just ignore thoseā€¦), it is 1112 items, not 1114 (I took out a couple items that are technically in-game, but are just dev experiments and not actually attainable).

ā€” edit: looks like some of these are not quite correct, eg ive listed the LED_1,2,3 etc blocks which you cant get in your inventory, so ignore those too, same for FRIEZE_1,2,3 variations of marble. The variations of seam blocks are fine though as those are seperate blocks you can have in your inventory.

4 Likes

The creative server config does not have any rate-limiting settings for the http shopping end point [aka is not rate limited]

If you want to configure it to the way it would be currently set for testing/next-live update, add to the server/config/creative.json to look like:

{
    "server": {
        ....
        "shoppingHttpDelay": 1 
    }
    ....
}

The rate limiting is between the ā€œend of one requestā€ and the ā€œstart of the next requestā€, so requesting every second is likely to hit the rate limiting as itll take more than 0ms to process the request in-general (+any variable latency) and may even be delayed a few server frames depending on what is happening/what other requests have been coming in from the game clients, so Iā€™d probably write it to make the next request 1 second ā€œafter you get a responseā€ to be sure you wont hit the rate limiting (Unless other people are doing http requests as well!)

The creative universe is just going to give you a fresh response everytime, the ETag is there because on live it will be configured at the Nginx level to cache responses for 30minutes so that they dont even bother hitting the server.

2 Likes

hm ā€¦ let me think about somethign cool to make and then iā€™ll start developing. Suggestions are welcome :-0

Man, I am so keen to do something with this but kinda limited when I have the game on PS4.
Guess I will just have to wait until the API is properly released.

I have written one in .net that you and anyone else are more than welcome to use.

1 Like