Field

new_field

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

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

new_field

parameters*

JSON

check method parameters

new_field Method Parameters

Parameter
Type
Desciption

name

string

Field name (e.g. Camp Nou)

sport

string

Sport (e.g. Football)

fieldLength

number

Field length in centimeters (e.g. 12000)

fieldWidth

number

Field width in centimeters (e.g. 9000)

cubeLength

number

The square size of a single cube (e.g. 300 for a cube of 3x3 meters)

new_field API Call Example

const axios = require('axios');

/* build request to use BWS Badges solution */
const request = {
{
  "solution": "BWS.NFT.GameCube",
  "operation": "new_field",
  "parameters":  {
     "name": "Camp Nou",
     "sport": "football",
     "fieldLength": 12000,
     "fieldWidth": 8000,
     "cubeLength": 300      
  }
}

/* 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);
  });

new_field Call Response

When the API call is successfully executed, it returns thefieldId, which will be used to link NFT Game Cube related objects.

All the cubes for that field are created when creating a new field.

{
  "statusCode": 200,
  "info": {
    "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2"
  }
}

list_fields

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

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

list_fields

parameters

JSON

(optional) check method parameters

list_fields Method Parameters (optional)

Parameter
Type
Desciption

field_id

string

Field Id

list_fields API Call Example

const axios = require('axios');

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

/* 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_fields Call Response

When the API call is successfully executed, it returns the list of fields you created or a single field if fieldIdparameter is included in the call.

{
  "statusCode": 200,
  "info": {
     "fields": [
            {
                "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2",
                "status": "ready",
                "data": {
                    "name": "Camp Nou",
                    "sport": "football",
                    "fieldLength": 12000,
                    "fieldWidth": 8000,
                    "cubeLength": 300
                }
            }
        ]
  }
}

delete_field

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

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

delete_field

parameters*

JSON

check method parameters

delete_field Method Parameters

Parameter
Type
Desciption

fieldId

string

Field Id to delete.

delete_field API Call Example

const axios = require('axios');

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

/* 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);
  });

delete_field Call Response

When the API call is executed without errors, it returns a successful status code.

All the cubes created and assigned to the deleted field are also deleted.

{
  "statusCode": 200,
  "info": {
    "fieldId": "5a1486f3-753c-4194-b2d4-ea68b6e420c2"
  }
}

Last updated