HTTP Shopping API Documentation

New doc are now available at:

https://docs.playboundless.com/modding/http-shopping.html

Original docs are below:


Below are the details for accessing the HTTP Shopping API via the Creative mode.
Please use Creative mode for building your application.
Please do not attempt to run these APIs against Testing or Live until we have fully released the feature.

How to query the per world base API URLs:

  • Request the world server listing via:
    curl http://127.0.0.1:8950/list-gameservers
    
  • From the JSON response extract the apiURL per world. This is the base route URL for all API calls to the world.

How to query the HTTP Shopping API:

  • GET request route is: /api/shopping/:type/:itemId
    • :type of S for buy-from shop-stands,
    • :type of B for sell-to request-baskets,
    • :itemId for the item requested.
  • Validation regex: "^/api/shopping/(B|S)/([0-9]+)$"
  • The request should include a header with your API key: Boundless-API-Key. There are different keys for the Testing and Live servers.
  • The response is a little-endian binary object.
  • To help with testing the item of ITEM_ROUGH_OORTSTONE is 32805

How to decode the binary response:

[
  u8    : size of beacon-name string
  u8    : size of guild-tag string
  char[]: beacon-name string (not null terminated)
  char[]: guild-tag string (not null terminated)
  u32   : item count
  u32   : shop activity
  i64   : price
  i16   : location-x
  i16   : location-z
  u8    : location-y
] for each result until end of response [ implicit count ]
16 Likes

Looks like its time for BUTT2.0 @Mayumichi

4 Likes

Yup I’ve been waiting for this <3

12 Likes

noice!

next forge data, augments, atlas metadata, etc right?

still super happy for this though

6 Likes

Discord Shopping Bot here I come!

1 Like

A few questions:

  • Do you know what kind of authentication you are targeting? IE: OAuth 2.0 vs Simple Key vs OortianCryptoMagic?
  • Are there plans for other reference calls like the world list for things like items?
1 Like

If I understand this correctly it’s no authentication, it’s just a static API key you shove into the header.

1 Like

@james are these hosted APIs at some public url or do you literally call 127 locally with the game running?

Edit: nm. Reread and see we’re querying locally to our local creative mode which runs on port 8950 so we can test it out. When the feature is released well be able to request API keys and will be provided the appropriate url.

Until they are released they are saying just start the creative mode servers locally and test against that.

I completely read past that! Thanks for pointing that out!

Not sure if that is what you are looking for

1 Like

I’m going to guess with the API key will come the URLto GET from

My guess is there is no validation on the creative server right now. As soon as I get the thing to start locally I can verify that

did anyone write a response parser yet? I have no experience with binaries :frowning:

I have some oort for sale on one of my local servers.

But when querying for it, I get a zero length response.

image

Is the response cached for a time and I should wait for it to appear, or am I doing something wrong?

Content type is text/plain here, if you check the http resonse code it will not be a 200 i’m hoping! (200 responses on this endpoint will be application/binary contenttypes). The endpoint is rate-limited to once per second to ensure cant stall responses for ‘real players’ in-game. Querying faster will just reject until a second passes.

I see, it’s a 404. I was expecting the node http library to throw an error automatically for that :smiley:

But I don’t see what’s wrong. The testing client can’t connect to creative servers atm, there’s a version mismatch, related? Or a problem with my request :thinking:

Can you share the list-gameservers response? I notice you have 2 different ports in the second screenshot.

{
  _lastUpdate: 1581859517.458244,
  addr: '192.168.43.54',
  apiURL: 'http://192.168.43.54:8859/api',
  atmosphereColor: [ 0.08850499987602234, 0.9416580200195312, 2.8768720626831055 ],
  chunksURL: 'http://192.168.43.54:8859/api/chunk',
  displayName: 'Creative',
  id: 1,
  info: {
    afkIdleInterval: 450,
    afkIdleThreshold: 900,
    maxPlayers: 0,
    players: 0,
    spawnWeight: 0.2619839906692505
  },
  ipAddr: '192.168.43.54',
  name: '1',
  numRegions: 1,
  planetsURL: 'http://192.168.43.54:8859/api/planet',
  region: 'creative',
  tier: 0,
  timeOffset: 1581846668.420033,
  waterColor: [ 0.07777100056409836, 0.31118398904800415, 0.5838239789009094 ],
  websocketURL: 'ws://192.168.43.54:8858/websocket/game',
  worldDescription: 'WORLD_TYPE_LUSH',
  worldSize: 192,
  worldType: 'LUSH'
},
{
  _lastUpdate: 1581859521.178272,
  addr: '192.168.43.54',
  apiURL: 'http://192.168.43.54:8959/api',
  atmosphereColor: [ 0.08850499987602234, 0.9416580200195312, 2.8768720626831055 ],
  chunksURL: 'http://192.168.43.54:8959/api/chunk',
  displayName: 'T3',
  id: 2,
  info: {
    afkIdleInterval: 450,
    afkIdleThreshold: 900,
    maxPlayers: 0,
    players: 0,
    spawnWeight: 0.26197099685668945
  },
  ipAddr: '192.168.43.54',
  name: '2',
  numRegions: 1,
  planetsURL: 'http://192.168.43.54:8959/api/planet',
  region: 'creative',
  tier: 2,
  timeOffset: 1581847835.290713,
  waterColor: [ 0.07777100056409836, 0.31118398904800415, 0.5838239789009094 ],
  websocketURL: 'ws://192.168.43.54:8958/websocket/game',
  worldDescription: 'WORLD_TYPE_LUSH',
  worldSize: 192,
  worldType: 'LUSH'
}

I had to skip the debug menu and run them directly from the command line, so the other server ports were copied from the first one with a small change.

“boundlessserver.exe” “–no-daemon” “–no-admin” “–config” “config/creative.json” “–port” “8858” “–apiPort” “8859” “–adminPort” “8860” “–udpPort” “8861” “–worldName” “1” “–worldId” “1” “–worldPath” “creativeworlds/1”

“boundlessserver.exe” “–no-daemon” “–no-admin” “–config” “config/creative.json” “–port” “8958” “–apiPort” “8959” “–adminPort” “8960” “–udpPort” “8961” “–worldName” “2” “–worldId” “2” “–worldPath” “creativeworlds/2”