Vordt wrote:Define the API endpoints and payload that will be used for updating market websites. For example:
POST /api/barter-stand/update
{
"standId": "123",
"items": [
{"itemId": "item1", "quantity": 5},
{"itemId": "item2", "quantity": 10}
]
}
I don't run any market site myself, but I wrote something to parse
Whatever Bay's market page and it uses these definitions (for slots; it doesn't care about the stands themselves):
- Code: Select all
public class BarterSlot
{
public int standID = -1;
public int sellingAmount = -1;
public int sellingStack = 1;
public float sellingQuality = -1;
public string sellingItem = "Unknown";
public int askingAmount = -1;
public float askingQuality = -1;
public string askingItem = "Unknown";
public string lastUpdate = "Unknown";
}
'Amount' and 'Stack' are different because a stand could offer e.g. '3x Bay Coin' for '8x Bar of Any Metal', and have '15 left' of that '3x Bay Coin'. (Technically those aren't stacks but some other way of combining stuff also used for stuff like seeds and Cave Dust; not sure what other term to use.) 'Last update' is a bot-specific thing, it's when their bot last checked the stand to update the site. Missing from this is the icon, which in their case can change the meaning of the item name (e.g. lead bay coins and gold bay coins are both called just 'Bay Coin'. Rather than a name+icon it would be better for an official API to send an official item identifier which consumers then convert to item names for end-users. The combination of item name, quality and quantity could be turned into its own sub-object instead of being repeated for both buy and sell, but that's a coding style preference thing. (Also, stand ID obviously shouldn't be a sequential int if it were global.)
So ideal would probably be something like this?
- Code: Select all
BarterStand
{
string id;
BarterSlot[] slots;
}
BarterSlot
{
BarterItem selling;
int stock;
BarterItem buying;
}
BarterItem
{
string id;
float quality;
int stack;
}
With a GET to /api/barter-stand/{id} getting a JSON of the relevant BarterStandObject (which contains 5 BarterSlots which each contain 2 BarterItems)? (You'd have to get the barter stand's ID by interacting with it in-game.)
There's some fringe information not included here (e.g. star icon, Memories of Pain, ingredients, how many bugs the Bug Collection was made of, etc) but that's not included on Whatever Bay's page either. This is what seems sensible to me, but I wasn't the one making the feature request.