'fetch' API Method

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

Blockchain operations are mostly asynchronous, meaning you request something and need to wait until the response or confirmation is available.

Because of that, you will find most Blockchain Web Services API calls are also asynchronous, meaning you get a jobId you can use it to fetch the operation status and results.

CODE EXAMPLE

Javascript code example to 'fetch' job status and results.

var parameters = {
  "jobId": "b064cc6b-f394-4ca4-9c51-be506e4cc59d",
};

$.ajax({
  method: 'POST',
  url: 'https://api.bws.ninja/v1/fetch',
  dataType: 'json',
  data: JSON.stringify(parameters),
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': 'ExV0d92KzQ8QgsTVnevddpbB8cUaAfPs7ntVF8g0'
  }
});

Fetch

Fetch asynchronous call status and results.

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

Use this operation to fetch the status and results of a previously called operation.

Request Body

NameTypeDescription

parameters*

JSON

// The fetch operation returns some common attributes
// and some specific results depending on the original call.

// Check the different operations docs to know what to expect.

// This is an example for BWS.NFT.zK/new call operation:

{
    "statusCode": 200,
    "statusMessage": "",
    "info": {
        "status": {
            "Value": "completed"
        },
        "request": {
            "solution": "BWS.NFT.zK",
            "version": 1,
            "network": "mumbai",
            "operation": "new",
            "parameters": {
                "name": "BWS NFT Limited Edition",
                "description": "This NFT is a limited edition, with only 100 copies in existence, each meticulously verified on the blockchain.",
                "image": "ipfs://QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
                "attributes": {
                    "trait_type": "Rarity",
                    "value": "Ultra rare"
                }
            }
        },
        "result": {
            "guid": "ed4f3b08-482d-44d6-b4f5-3e1209a8a00b",
            "nftTxHash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
            "nftId": "62",
            "nftIPFSHash": "QmVqX5XZKnzVi9fvvMFWQEmSksV6K3TefxkzdbfrsoiPKU",
            "nftImageIPFSHash": "QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
            "nftJson": {
                "name": "BWS NFT Limited Edition",
                "description": "This NFT is a limited edition, with only 100 copies in existence, each meticulously verified on the blockchain.",
                "image": "ipfs://QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
                "attributes": {
                    "trait_type": "Rarity",
                    "value": "Ultra rare"
                }
            },
            "url": {
                "nft": "https://ipfs.io/ipfs/QmVqX5XZKnzVi9fvvMFWQEmSksV6K3TefxkzdbfrsoiPKU",
                "image": "https://ipfs.io/ipfs/QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
                "transaction": "https://mumbai.polygonscan.com/tx/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9"
            },
            "status": "created",
            "network": "mumbai",
            "transferCodes": {
                "owner": "28fd5c00-085a-4f0f-b750-a4bdcf990270",
                "receiver": "0539f"
            }
        },
        "hash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
        "txnUrl": "https://mumbai.polygonscan.com/tx/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
        "receipt": {
            "_type": "TransactionReceipt",
            "blockHash": "0x56376d007d2158ffa7a196a74233db2372459ae11579e9ebce9db8cd425842f9",
            "blockNumber": 41833444,
            "contractAddress": null,
            "cumulativeGasUsed": "2448839",
            "from": "0xAb0003FA8D140ece0d63fbA2743525671FE5FE08",
            "gasPrice": "1807824549",
            "gasUsed": "134939",
            "hash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
            "index": 11,
            "logs": [
                {
                    "_type": "log",
                    "address": "0xe013b879a875242193b91E6F3D8BE02458e918C1",
                    "blockHash": "0x56376d007d2158ffa7a196a74233db2372459ae11579e9ebce9db8cd425842f9",
                    "blockNumber": 41833444,
                    "data": "0x",
                    "index": 46,
                    "topics": [
                        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                        "0x0000000000000000000000000000000000000000000000000000000000000000",
                        "0x000000000000000000000000ab0003fa8d140ece0d63fba2743525671fe5fe08",
                        "0x000000000000000000000000000000000000000000000000000000000000003e"
                    ],
                    "transactionHash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
                    "transactionIndex": 11
                },
                {
                    "_type": "log",
                    "address": "0xe013b879a875242193b91E6F3D8BE02458e918C1",
                    "blockHash": "0x56376d007d2158ffa7a196a74233db2372459ae11579e9ebce9db8cd425842f9",
                    "blockNumber": 41833444,
                    "data": "0x000000000000000000000000000000000000000000000000000000000000003e",
                    "index": 47,
                    "topics": [
                        "0xf8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce7"
                    ],
                    "transactionHash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
                    "transactionIndex": 11
                },
                {
                    "_type": "log",
                    "address": "0xe013b879a875242193b91E6F3D8BE02458e918C1",
                    "blockHash": "0x56376d007d2158ffa7a196a74233db2372459ae11579e9ebce9db8cd425842f9",
                    "blockNumber": 41833444,
                    "data": "0x000000000000000000000000000000000000000000000000000000000000003e",
                    "index": 48,
                    "topics": [
                        "0xf00d28232b285f24f2e38415deb2ceb31069e70d4505838b3911b4f02058502e"
                    ],
                    "transactionHash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
                    "transactionIndex": 11
                },
                {
                    "_type": "log",
                    "address": "0x0000000000000000000000000000000000001010",
                    "blockHash": "0x56376d007d2158ffa7a196a74233db2372459ae11579e9ebce9db8cd425842f9",
                    "blockNumber": 41833444,
                    "data": "0x0000000000000000000000000000000000000000000000000000ddde1cbd7cb7000000000000000000000000000000000000000000000000862152d8b68eff6d0000000000000000000000000000000000000000000011e041061d5852d24942000000000000000000000000000000000000000000000000862074fa99d182b60000000000000000000000000000000000000000000011e04106fb366f8fc5f9",
                    "index": 49,
                    "topics": [
                        "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
                        "0x0000000000000000000000000000000000000000000000000000000000001010",
                        "0x000000000000000000000000ab0003fa8d140ece0d63fba2743525671fe5fe08",
                        "0x000000000000000000000000f903ba9e006193c1527bfbe65fe2123704ea3f99"
                    ],
                    "transactionHash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
                    "transactionIndex": 11
                }
            ],
            "logsBloom": "0x0000000000000000000000000000000000000000002000000000001000000000000000000000002000000000002000000000800000000000000000000000000000000000000000000000000800000081000000400000000000010000000000000000000002080000000000000000080020010000000000008000001000000100000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000200000000000000000000000000200c000000002000000000001000000000000000000000000000000100001001020000000080000000000200000000000000000000000000000000000000000100000",
            "status": 1,
            "to": "0xe013b879a875242193b91E6F3D8BE02458e918C1"
        },
        "networkCost": 0.0,
        "networkFee": 0.0,
        "networkTotal": 0.0,
        "certificateOfTrust": "https://s3.amazonaws.com/bws-backoffice-website-infra-staging/tx/mumbai/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9.pdf",
        "certificateOfTrustJPG": "https://s3.amazonaws.com/bws-backoffice-website-infra-staging/tx/mumbai/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9.jpg",
        "certificateOfTrustUrl": "https://staging.bws.ninja/tx.html?t=0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
        "guid": "0ee9b165-064d-41c8-904a-b72de22cced6",
        "type": {
            "value": "blockchain-job"
        },
        "timestampInMillis": 1698684152535
    }
}

Method Parameters

ParameterTypeValue(s)

jobId

string

The jobId you get when running a call API method.

Fetch Status

When calling fetch API endpoint to get a job status, you can get one of the following statuses:

StatusDescription

registered

The job has correctly been registered for execution.

calling

The transaction is been called.

running

The transaction is running on Blockchain Network.

transferring

In some scenarios, there is a transfer (e.g. transferring an NFT).

snapshotting

The blockchain transaction has finished, and BWS is creating the Certificate Of Trust (optional).

completed

Call has completed (success).

failed

Call execution has failed.

API RESPONSE EXAMPLE (BWS.NFT.zK)

A response showing a job has correctly been registered.

{
    "statusCode": 200,
    "statusMessage": "",
    "info": {
        "status": {
            "Value": "completed"
        },
        "request": {
            "solution": "BWS.NFT.zK",
            "version": 1,
            "network": "mumbai",
            "operation": "new",
            "parameters": {
                "name": "BWS NFT Limited Edition",
                "description": "This NFT is a limited edition, with only 100 copies in existence, each meticulously verified on the blockchain.",
                "image": "ipfs://QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
                "attributes": [{
                    "trait_type": "Rarity",
                    "value": "Ultra rare"
                }]
            }
        },
        "result": {
            "guid": "ed4f3b08-482d-44d6-b4f5-3e1209a8a00b",
            "nftTxHash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
            "nftId": "62",
            "nftIPFSHash": "QmVqX5XZKnzVi9fvvMFWQEmSksV6K3TefxkzdbfrsoiPKU",
            "nftImageIPFSHash": "QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
            "nftJson": {
                "name": "BWS NFT Limited Edition",
                "description": "This NFT is a limited edition, with only 100 copies in existence, each meticulously verified on the blockchain.",
                "image": "ipfs://QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
                "attributes": {
                    "trait_type": "Rarity",
                    "value": "Ultra rare"
                }
            },
            "url": {
                "nft": "https://ipfs.io/ipfs/QmVqX5XZKnzVi9fvvMFWQEmSksV6K3TefxkzdbfrsoiPKU",
                "image": "https://ipfs.io/ipfs/QmcduEBAppXxnyn37deHHf33Ep7cPbYxn1mH36Nvvowkiu",
                "transaction": "https://mumbai.polygonscan.com/tx/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9"
            },
            "status": "created",
            "network": "mumbai",
            "transferCodes": {
                "owner": "28fd5c00-085a-4f0f-b750-a4bdcf990270",
                "receiver": "0539f"
            }
        },
        "hash": "0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
        "txnUrl": "https://mumbai.polygonscan.com/tx/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
        "certificateOfTrust": "https://s3.amazonaws.com/bws-backoffice-website-infra-staging/tx/mumbai/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9.pdf",
        "certificateOfTrustJPG": "https://s3.amazonaws.com/bws-backoffice-website-infra-staging/tx/mumbai/0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9.jpg",
        "certificateOfTrustUrl": "https://staging.bws.ninja/tx.html?t=0x4ce447adb73c291760a9674ab98380095a1a21c1d7638a9989867d8f33a817d9",
        "guid": "0ee9b165-064d-41c8-904a-b72de22cced6",
        "type": {
            "value": "blockchain-job"
        },
        "timestampInMillis": 1698684152535
    }
}

Last updated