BWS API Docs
Contact UsCreate AccountSign In
  • Welcome!
    • Developer Grants
  • Quick Start
  • Platform Fees
    • Fees Calculator
  • API How Tos
    • API Endpoint
    • Authentication
      • Get your API Key
    • Main API Methods
      • 'call' API Method
      • 'fetch' API Method
    • API Responses
      • Error Status Codes
  • Certificate Of Trust
  • Media Assets
    • BWS Logo
    • Snapshots
      • BWS.IPFS.Upload
  • PLATFORM APIs
    • BWS.IPFS.Upload
      • Solution Overview
      • Operations
    • BWS.Blockchain.Save
      • Solution Overview
      • Operations
    • BWS.Blockchain.Hash
      • Solution Overview
      • Operations
    • BWS.NFT.zK
      • Solution Overview
        • NFT Ownership
        • NFT Data Location
        • Available Networks
      • Operations
        • Create NFT
        • List NFTs
        • Transfer NFT
        • Send NFT by Email
      • NFT Attributes (traits)
  • Marketplace Solutions
    • BWS.Blockchain.Badges
      • Badges User Interface
      • Badges API
        • Issuers
        • Badges
        • Awards (Credentials)
    • BWS.NFT.GameCube
      • NFT Game Overview
      • NFT Game Cube API
        • Calendar
        • Field
        • Cubes
        • Plays (Field-Calendar)
        • Match
        • Prizes
        • Event Types
        • Live Events
    • BWS.ESG.Credits
      • Solution Overview
      • ESG Credits API
        • Taxonomy
        • Translations
        • Currencies
        • Frameworks
        • Projects
        • Issuers
        • Assets
        • Investors
        • Positions
        • Portfolios
        • Impacts
        • Blockchain
        • Users
  • TELEGRAM BOTS
    • X BOT
      • Install
        • BYOK (X API Token)
      • How does it work?
      • Commands
Powered by GitBook
On this page
  • list_cubes
  • Request Body
  • list_cubes API Call Example
  • update_cube-price
  • Request Body
  • update_cube-price API Call Example

Was this helpful?

  1. Marketplace Solutions
  2. BWS.NFT.GameCube
  3. NFT Game Cube API

Cubes

Represents a zone or tile within a Field.

Each Cube is a unique NFT owned by a fan. It tracks ownership, enables rewards, and reflects live event impacts during matches.

Cubes are generated automatically when creating a new field.

list_cubes

POST https://api.bws.ninja/v1/call

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

list_cubes

parameters*

JSON

check method parameters

new_field Method Parameters

Parameter
Type
Desciption

fieldId

string

Field Id.

limit

number

The maximum number of cubes returned (a field can have hundreds of cubes).

lastEvaluatedKey

(optional) If more cubes are available, include the returned key to get the next chink of cubes.

list_cubes API Call Example

const axios = require('axios');

/* build request to use BWS Badges solution */
const request = {
{
  "solution": "BWS.NFT.GameCube",
  "operation": "list_cubes",
  "parameters":  {
     "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
     "limit": 5    
  }
}

/* call BWS API using Axios */
let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.bws.ninja/v1/call',
  headers: { 
    'X-Api-Key': 'XqaLg...... A5k2V729v', /* use your API key here! */
    'Content-Type': 'application/json'
  },
  data : JSON.stringify(request)
};

axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

list_cubes Call Response

When the API call is successfully executed, it returns a list of cubes and their related cube data, including thecubeId. If more cubes are available, the field lastEvaluatedKey is returned (include it on the API call for getting the next chunk of cubes).

{
  "statusCode": 200,
  "info": {
        "cubes": [
            {
                "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
                "cubeId": "ffcab6f9-1e3f-49df-9d53-28b1cbc1df57",
                "cubeIndex": "2700_1800",
                "status": "created",
                "data": {
                    "x": 2700,
                    "y": 1800,
                    "cubeLength": 300,
                    "i": 9,
                    "j": 6
                }
            },
            {
                "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
                "cubeId": "ff86a9b3-ac68-456d-af12-2d4dc8622b94",
                "cubeIndex": "11400_1200",
                "status": "created",
                "data": {
                    "x": 11400,
                    "y": 1200,
                    "cubeLength": 300,
                    "i": 38,
                    "j": 4
                }
            },
            {
                "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
                "cubeId": "ff742a73-5cff-4f86-b8cd-afa8fc864f95",
                "cubeIndex": "9000_7500",
                "status": "created",
                "data": {
                    "x": 9000,
                    "y": 7500,
                    "cubeLength": 300,
                    "i": 30,
                    "j": 25
                }
            },
            {
                "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
                "cubeId": "ff2bec99-1e1c-479b-adb6-79775780eb56",
                "cubeIndex": "11400_3600",
                "status": "created",
                "data": {
                    "x": 11400,
                    "y": 3600,
                    "cubeLength": 300,
                    "i": 38,
                    "j": 12
                }
            },
            {
                "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
                "cubeId": "ff248cbb-e7ab-4510-817f-53f7d56cf3e0",
                "cubeIndex": "8400_7200",
                "status": "created",
                "data": {
                    "x": 8400,
                    "y": 7200,
                    "cubeLength": 300,
                    "i": 28,
                    "j": 24
                }
            }
        ],
        "lastEvaluatedKey": "ff248cbb-e7ab-4510-817f-53f7d56cf3e0"
  }
}

update_cube-price

POST https://api.bws.ninja/v1/call

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

update_cube-price

parameters

JSON

check method parameters

update_cube-price Method Parameters (optional)

Parameter
Type
Desciption

field_id

string

Field Id

cubesList

list

A list of cubes whose price needs to be updated. Use cube data i and j indexes to identify each cube using the format i_j (e.g. 40_0).

priceInCents

number

Price in USD cents (e.g. 500 to indicate a 5USD cube price)

update_cube-price API Call Example

const axios = require('axios');

/* build request to use BWS Badges solution */
const request = {
{
  "solution": "BWS.NFT.GameCube",
  "operation": "update_cube-price",
  "parameters":  {
     "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
     "cubesList": ["48_0", "51_0", "54_0"],
     "princeInCents": 500
  }
}

/* call BWS API using Axios */
let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.bws.ninja/v1/call',
  headers: { 
    'X-Api-Key': 'XqaLg...... A5k2V729v', /* use your API key here! */
    'Content-Type': 'application/json'
  },
  data : JSON.stringify(request)
};

axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

update_cube-price Call Response

When the API call is successfully executed, it returns the number of correctly updated cubes, the number of invalid detected cubes, and the list of invalid cubes.

{
  "statusCode": 200,
  "info": {
        "updatedCubes": 3,
        "invalidCubes": 1,
        "invalidCubesList": [
            "300_848483847938474000000"
        ]
  }
}

PreviousFieldNextPlays (Field-Calendar)

Last updated 1 month ago

Was this helpful?