Marketplace - nomstead/open-api GitHub Wiki

Marketplace API Documentation

Overview

The Marketplace API provides developers with access to items available for purchase or sale within the game. The API returns two lists: items that can be bought by players (toBuy) and items that can be sold by players (toSell).

Endpoint

Get Marketplace Items

  • URL: https://api.nomstead.com/open/marketplace
  • Method: GET
  • Response Format: application/json

Response Structure

The response contains two main arrays: toBuy and toSell.

Response Example

{
  "toBuy": [
    {
      "tile": {
        "url": "https://nomstead.com/owner-slug/tile-id",
        "owner": "owner slug"
      },
      "object": {
        "slug": "object slug",
        "category": "object category",
        "subCategory": "object sub category",
        "metadata": "object metadata",
        "imageUrl": "full image url",
        "thumbnailImageUrl": "Thumbnail image url",
      },
      "pricing": {
        "unitPrice": 100,
        "availableQuantity": 10
      }
    }
  ],
  "toSell": [
    {
      "tile": {
        "url": "https://nomstead.com/owner-slug/tile-id",
        "owner": "owner slug"
      },
      "object": {
        "slug": "object slug",
        "category": "object category",
        "subCategory": "object sub category",
        "metadata": "object metadata",
        "imageUrl": "full image url",
        "thumbnailImageUrl": "Thumbnail image url",
      },
      "pricing": {
        "unitPrice": 50,
        "desiredQuantity": 5
      }
    }
  ]
}

Fields Description

  • tile

    • url: The URL of the tile where the dropbox is located.
    • owner: The slug of the owner of the tile.
  • object

    • slug: The unique identifier for the object.
    • category: The category of the object.
    • subCategory: The subcategory of the object.
    • metadata: Additional metadata related to the object.
    • imageUrl: The URL of the object's image.
    • thumbnailImageUrl: The URL of the object's thumbnail image.
  • pricing

    • unitPrice: The price per unit of the object.
    • availableQuantity: The quantity of the object available for purchase (in toBuy).
    • desiredQuantity: The quantity the player would like to have based on the available gold (in toSell).

Usage

To retrieve the marketplace items, send a GET request to the endpoint. The response will contain two arrays, toBuy and toSell, with details about the available items.

Example Request

curl -X GET https://api.nomstead.com/open/marketplace

Error Handling

If an error occurs during the request, the API will return an appropriate error message and status code.

Example Error Response

{
  "error": "An error occurred while fetching marketplace data."
}