Skip to content

WebAPI 5

DosMike edited this page Jul 29, 2018 · 2 revisions

VillagerShop 1.9+ implements WebAPI 5.2.x

GET /vshop/shop

Requires: -
Returns: VShop[]
Returns a list of all shop on the server

GET /vshop/shop/{id}

Requires: -
Returns: VShop
Returns the shop with given shop UUID

POST /vshop/shop

Requires: VShop
Returns: VShop
Create a new shop from request body. The only values read from the body are:
entityType, entityVariant, name, location, rotation.

You can put the same object onto the returned object's id.

PUT /vshop/shop/{id}

Requires: VShop
Returns: VShop
Dynamically updates all values of this shop except items.

DELETE /vshop/shop/{id}

Requires: -
Returns: VShop
Delete a shop.

GET /vshop/shop/{id}/item

Requires: -
Returns: Item[]
Get the item listing for this shop.

GET /vshop/shop/{id}/item/{item}

Requires: -
Returns: Item
Get information about a specific shop item.

POST /vshop/shop/{id}/item

Requires: Item
Returns: Item
Add a item at the end of the shops item list. A shop can hold up to 27 items before the inventory is full.

PUT /vshop/shop/{id}/item/{item}

Requires: Item
Returns: Item
Replaces the items at this position with the new item definition.

DELETE /vshop/shop/{id}/item/{item}

Requires: -
Returns: Item
Delete this item from the shop listing, decrementing the index for all items with position > item.

Structure VShop

UUID uid
UUID string uniquely identifying the shop. This field is never read.

String name
The &code-escaped name of the shop.

Location location
A Location object pointing to the shop entity.

Decimal rotation
The Rotation of this shop in degree around the up-axis.

String entityType
The entity identifier. Example minecraft:villager

String entityVariant
A string defining the variant of the entityType. Supports most vanilla mobs (see minecraft wiki for values).
If the entityType is Sponge:Human the variant may be a player id in order to load the player skin.

UUID owner
The UUID of the player owning this shop. Only valid if playerShop is true.

Boolean playerShop
True if this shop is owned by a player.

Location stockContainer
The location of a Container to pull and put stock items from. Note that setting a stock limit for items has no effect unless the shop has a stock container set.

Item[] stockItems
A list of items as defined below.

Structure Item

Integer id
The index of this item within the shop. This field is never read.

UUID uid
The UUID of the shop this item is listed within. This field is never read.

Decimal buyPrice
The amount of money it costs a player to buy the amount of items specified in item. Both buyPrice and sellPrice can't be null!

Decimal sellPrice
The amount of money a player receives for selling the amount of items specified in item. Both buyPrice and sellPrice can't be null!

String currency
The id or name of the currency to use for this item listing. Fallback is default currency.

Integer stock
How many single items of this type are currently socked in the stock container OR The size of the item stack in this listing if there's no stock for this item.

Integer maxStock
How much of this item can be stock up at a time, or 0 if hasStock is false indicating unlimited stock.

Boolean hasStock
True if this shop has a maximum on how much single items of this type the stock container may hold.

ItemStack item
A Minecraft item-stack describing the item for sale.