Calendar Match

Images The images sent using base64 encoding are saved into IPFS. When getting match details using the list_maches operation, the IPFS URL is returned.

new_match

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

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

new_match

parameters*

JSON

check method parameters

new_match Method Parameters

Optionals

All parameters are optional (except calendarId and startTimeInMillis).

Parameter
Type
Desciption

calendarId*

string

Calendar Id the match should be included in.

startTimeInMillis*

number

The expected match start time in milliseconds.

name

string

The match short name.

description

string

Match description.

image

string

An image base64 encoded string to announce the match.

team1Name

string

The team name (e.g. Manchester City)

team1Flag

string

An image base64 ecoded string representing the team flag.

team2Name

string

The team name (e.g. LA Lakers)

team2Flag

string

An image base64 ecoded string representing the team flag.

status

string

The match status. Use one of the following values: "scheduled", "playing", "finished", "canceled"

priceInCents

number

The price in USD cents (e.g. 1000 for 10 USD)

new_match API Call Example

const axios = require('axios');

/* build request to create a new NFT Game Cube match */
const request = {
{
  "solution": "BWS.NFT.GameCube",
  "operation": "new_match",
  "parameters":  {
      "calendarId": "8a7324f4-311d-43a8-a28f-87d9c424c354",
      "startTimeInMillis": 1737795600000,
      "name": "PSG vs Man City",
      "description": "Paris Saint-Germain will face Manchester City ...",
      "image": "9j/4AAQSkZJRgABAQIAHA... " /* base64 encoded image string */
  }
}

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

When the API call is successfully executed, it returns thematchId for the newly created match.

{
  "statusCode": 200,
  "info": {
        "matchId": "e16d3f98-4eeb-44b9-837c-eddbbfe305ee"
  }
}

update_match

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

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

update_match

parameters*

JSON

check method parameters

update_match Method Parameters

Optionals

All parameters are optional (except calendarId and matchId) Only provide those you want to update.

Parameter
Type
Desciption

calendarId*

string

Calendar Id the match is included in.

matchId*

string

The Match Id we want to update.

startTimeInMillis

number

The expected match start time in milliseconds.

name

string

The match short name.

description

string

Match description.

image

string

An image base64 encoded string to announce the match.

team1Name

string

The team name (e.g. Manchester City)

team1Flag

string

An image base64 ecoded string representing the team flag.

team2Name

string

The team name (e.g. LA Lakers)

team2Flag

string

An image base64 ecoded string representing the team flag.

status

string

The match status. Use one of the following values: "scheduled", "playing", "finished", "canceled"

priceInCents

number

The price in USD cents (e.g. 1000 for 10 USD)

update_match API Call Example

const axios = require('axios');

/* build request to update match description only */
const request = {
{
  "solution": "BWS.NFT.GameCube",
  "operation": "new_match",
  "parameters":  {
      "calendarId": "8a7324f4-311d-43a8-a28f-87d9c424c354",
      "matchId": "e16d3f98-4eeb-44b9-837c-eddbbfe305ee",
      "description": "Paris Saint-Germain will face Manchester City ...",
  }
}

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

When the API call is successfully executed, it returns thematchId for the updated match.

{
  "statusCode": 200,
  "info": {
        "matchId": "e16d3f98-4eeb-44b9-837c-eddbbfe305ee"
  }
}

list_matches

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

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

list_matches

parameters

JSON

check method parameters

list_matches Method Parameters (optional)

Parameter
Type
Desciption

calendar_id

string

The Calendar Id the match is linked to.

matchId

string

(optional) The Match Id we want to list.

list_matches API Call Example

const axios = require('axios');

/* build request to use BWS Badges solution */
const request = {
{
  "solution": "BWS.NFT.GameCube",
  "operation": "list_matches",
  "parameters":  {
      "calendarId": "8a7324f4-311d-43a8-a28f-87d9c424c354",
      "matchId": "e16d3f98-4eeb-44b9-837c-eddbbfe305ee"  
  }
}

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

When the API call is successfully executed, it returns the matches for the provided calendar. If we give a Match Id, it will just return the match we want to list.

{
  "statusCode": 200,
  "info": {
    "matches": [
        {
            "calendarId": "8a7324f4-311d-43a8-a28f-87d9c424c354",
            "matchId": "e16d3f98-4eeb-44b9-837c-eddbbfe305ee",
            "startTimeInMillis": "1737795600000",
            "status": "scheduled",
            "data": {
                "name": "PSG vs Man City",
                "description": "Paris Saint-Germain will face Manchester City ...",
                "image": "https://ipfs.bws.ninja/ipfs/QmQnRDsQPvNJ9RgT9bagHmCLQVxCyZxatkPpj3Avb1hsM8"
            }
        }
    ]
  }
}

delete_match

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

Request Body

Name
Type
Description

solution*

string

BWS.NFT.GameCube

operation*

string

delete_calendar

parameters*

JSON

check method parameters

delete_match Method Parameters

Parameter
Type
Desciption

matchId

string

The Match Id of the match we want to delete.

calendarId

string

The Calendar Id the match is linked to.

delete_match API Call Example

const axios = require('axios');

/* build request to use BWS Badges solution */
const request = {
{
  "solution": "BWS.NFT.GameCube",
  "operation": "delete_match",
  "parameters":  {
     "matchId": "e16d3f98-4eeb-44b9-837c-eddbbfe305ee",
     "calendarId": "8a7324f4-311d-43a8-a28f-87d9c424c354"  
  }
}

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

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

{
  "statusCode": 200
}

Last updated

Was this helpful?