DOCUMENTS

Documents of the BORA project.

ERC721 APIs

The ERC721 API is an API for managing ERC721 tokens.

1 Request to mint an ERC721 token to a user

GET /sc/erc721/v1/admin/{appNo}/{contractId}/mintwithtokenuri HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
to*User Wallet address to receiveformDatastring, length(42)
tokenId*ERC721 token ID to mintformDataint
tokenURI*Token's Metadata URI to mintformDatastring

Response

{
"status": 200,
"data: {
"tx_hash": "0x8da32434d08be077c7995b7cb4b89ab4b8a65ade57004793da20bed19674e1bc"
}
}

2 Approve other user or contract to transfer one's ERC721 token (approve)

GET /sc/erc721/v1/erc721/{contractId}/approve HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
memberNo*Member No of user to execute approve functionformDataint
to*Spender address to approveformDatastring, length(42)
tokenId*Token ID to be approvedformDataint

Response

{
"status": 200,
"data: {
"tx_hash": "0xd6793c9546bd8c33569e00777b07fa46fe307b958ebe7f81afd895f8fab1c2f9"
}
}

3 Transfer an ERC721 token to other (transferFrom)

GET /sc/erc721/v1/erc721/{contractId}/transferfrom HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
memberNo*Member No of user to execute transferFrom functionformDataint
from*User Wallet address to transfer fromformDatastring, length(42)
to*User Wallet address to transfer toformDatastring, length(42)
tokenId*Token ID to be transferredformDataint

Response

{
"status": 200,
"data: {
"tx_hash": "0x998fadbc39a49532a9540d76eca6c1842a1a734812925863a3be6e6d65a593cb"
}
}

4 Get number of ERC721 tokens of a user

GET /sc/erc721/v1/erc721/{contractId}/balanceof/{owner} HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
owner*User Wallet address to get balanceformDatastring, length(42)

Response

{
"status": 200,
"data: {
"result": 3
}
}

5 Get owner of ERC721 token

GET /sc/erc721/v1/erc721/{contractId}/ownerof/{tokenId} HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
tokenId*Token ID to get ownerurlint

Response

{
"status": 200,
"data: {
"result": "0x27b73b282f249c42f516e0aa5d8da552681676b7"
}
}

6 Get ERC721 token ID(by index)

GET /sc/erc721/v1/erc721/{contractId}/tokenbyindex/{index} HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
index*Index to get token IDurlint

Response

{
"status": 200,
"data: {
"result": 12
}
}

7 Get user's ERC721 token ID (by index)

GET /sc/erc721/v1/erc721/{contractId}/tokenofownerbyindex/{owner}/{index} HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
owner*User Wallet address to get token IDurlstring, length(42)
index*Index to get token IDurlint

Response

{
"status": 200,
"data: {
"result": 12
}
}

8 Get Token URI of ERC721 token

GET /sc/erc721/v1/erc721/{contractId}/tokenuri/{tokenId} HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
tokenId*Token ID to get token URIurlint

Response

{
"status": 200,
"data: {
"result": "QmaKppL9Vjk4wv6Wex5D8k1bjsyqH3H6yJbAsWsJb5k5DQ"
}
}

9 Get total supply of entire ERC721 tokens

GET /sc/erc721/v1/erc721/{contractId}/totalsupply HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint

Response

{
"status": 200,
"data: {
"result": 10
}
}

10 Get approval of an ERC721 token

GET /sc/erc721/v1/erc721/{contractId}/getapproved/{tokenId} HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint
tokenId*Token ID to get approvalurlint

Response

{
"status": 200,
"data: {
"result": "0xd35aa28e97fd1cf40bf8b4ebe56fb2670ea1fee3"
}
}

11 Get name of ERC721 contract

GET /sc/erc721/v1/erc721/{contractId}/name HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint

Response

{
"status": 200,
"data: {
"result": "BORA721"
}
}

12 Get symbol of ERC721 contract

GET /sc/erc721/v1/erc721/{contractId}/symbol HTTP/1.1
HOST: testnet-chain-api.boraecosystem.com

Parameters

ParameterRequiredValuesDescriptionParameter TypeData Type
Authorization*Bearer {Client's AccessToken}headerstring
contractId*ERC721 contract IDurlint

Response

{
"status": 200,
"data: {
"result": "1.0.0"
}
}

Error Code

HTTP CodeStatusDescriptionExample
200400Validation Error: Invalid parameters.
{
"status": 400,
"error": [
{
"message": "integer validation failed on index",
"field": "index",
"validation": "integer"
}
]
}
200401Unauthorized: You aren’t authenticated.
{
"status": 401,
"error": [
{
"message": "E_FORBIDDEN: Access Token is not right",
}
]
}
200404Not Found: Failed to find URL.
{
"status": 404,
"error": [
{
"message": "E_ROUTE_NOT_FOUND: Route not found GET /erc721",
}
]
}
200422Unprocessable Entity: The request was unable to be followed.
{
"status": 422,
"error": [
{
"message": "E_CONTRACT_NOT_FOUND: appNo or contractId not found",
}
]
}
200500Internal Server Error: Internal Server Error.
{
"status": 500,
"error": [
{
"message": "E_DATABASE_ERROR: Internal database error",
}
]
}
4XX, 5XXOther Error
HTTP Code: 503
Body: Reponse: 503, Under Maintenance