Skip to content

Metadata API

Metadata API offers the metadata uploading and searching for its information.

Upload metadata

Uploads the metadata to the public IPFS. It offers the address (uri) of the uploaded metadata IPFS and the gateway address (gatewayUrl) that can be accessed via HTTP.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/metadata
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/metadata
HTTP Method POST
Content-Type application/json

Header parameters

Field Name Description Type Required
Authorization Authentication token required to call the API string Y

Request body

Field Name Description Type Required
name the NFT name string Y
description the NFT description string N
image This is the NFT image address. This is the public website address or the public IPFS address for uploading images to IPFS. string Y
animationUrl the address for the NFT animation string N
youtubeUrl the Youtube address string N
imageData the NFT image information string N
externalUrl the external url string N
backgroundColor the background color info of the token (OpenSea) string N
attributes These are the information of the metadata attributes. These contain the additional info that are not described in the metadata. json N
attributes.traitType The names of the items that constitute attributes string N
attributes.maxValue the maximum value of trait number N
attributes.value This is the trait value. It should be less than attributes.maxValue. If attributes.displayType is date, set this value following unix timestamp (seconds) format. string or number N
attributes.displayType This is the display type of the trait. The default value is string. number: numeric type boost_percentage: percentage (OpenSea Boosts) boost_number: numeric (OpenSea Boosts) date: date type (example: Tuesday, January 1st, 2019) string N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.contentType the contents type string
data.uri the IPFS address to which the metadata was uploaded string
data.gatewayUrl the gateway address where the metadata can be found string

Request sample

curl -X 'POST' 
  'https://sandbox-bc-api.qpyou.cn/core/v1/metadata' 
  -H 'accept: application/json' 
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXlObyI6MSwiaWQiOiJwbGF0Zm9ybSIsImNvbXBhbnkiO' 
  -H 'Content-Type: application/json' 
  -d '{
  "name": "Arbiter'''s Robe",
  "description": "desc",
  "image": "https://image01.c2x.world/equip_92053030.gif",
  "animationUrl": "https://image01.c2x.world/equip_92053030.gif",
  "youtubeUrl": "https://www.youtube.com",
  "externalUrl": "https://dex.c2xnft.com/market?key=4423",
  "backgroundColor": "##ffffff",
  "attributes": [
    {
      "traitType": "traitType",
      "maxValue": "10",
      "value": "1",
      "displayType": "displayType"
    }
  ]
}'

Response sample

{
  "code": 0,
  "message": "success",
  "data": {
    "contentType": "application/json",
    "uri": "ipfs://QmfAsGExBG8kChweQtZcKZWqUxC4qBYhyWVokE5EQHoyWS",
    "gatewayUrl": "https://sandbox-bc-file.qpyou.cn/ipfs/QmfAsGExBG8kChweQtZcKZWqUxC4qBYhyWVokE5EQHoyWS"
  }
}

Get metadata information

Gets the metadata via the content identifier(cid).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/metadata/{cid}
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/metadata/{cid}
HTTP Method GET
Content-Type application/json

Header parameters

Field Name Description Type Required
Authorization Authentication token required to call the API string Y

Path parameters

Field Name Description Type Required
cid This is the IPFS contents identifier. This is the hash value that is used to identifies the data in IPFS, and it can be found in uri(ipfs://{CID}) or gatewayUrl(https://{GATEWAY_URL}/ipfs/{CID}). string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data the metadata information json
data.uri the IPFS address of the metadata string
data.gatewayUrl the gateway address of the metadata string
data.metadata the metadata json
data.metadata.name the NFT name string
data.metadata.description the NFT description string
data.metadata.image This is the NFT image address. This is the public website address or the public IPFS address. string
data.metadata.animationUrl the address for the NFT animation string
data.metadata.youtubeUrl the Youtube address string
data.metadata.imageData the NFT image information string
data.metadata.externalUrl the external url string
data.metadata.backgroundColor the background color info of the token (OpenSea) string
data.metadata.attributes These are the information of the metadata attributes. These contain the additional info that are not described in the metadata. json
data.metadata.attributes.traitType The names of the items that constitute attributes string
data.metadata.attributes.maxValue the maximum value of trait number
data.metadata.attributes.value This is the trait value. It should be less than data.metadata.attributes.maxValue. If data.metadata.attributes.displayType is date, set this value following unix timestamp (seconds) format. string or number
data.metadata.attributes.displayType This is the display type of the trait. The default value is string. number: numeric type boost_percentage: percentage (OpenSea Boosts) boost_number: numeric (OpenSea Boosts) date: date type (example: Tuesday, January 1st, 2019) string

Request sample

curl -X 'GET' 
  'https://sandbox-bc-api.qpyou.cn/core/v1/metadata/QmfAsGExBG8kChweQtZcKZWqUxC4qBYhyWVokE5EQHoyWS' 
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXlObyI6MSwiaWQiOiJwbGF0Zm9ybSIsImNvbXBhbnkiO' 
  -H 'accept: application/json'

Response sample

{
  "code": 0,
  "message": "success",
  "data": {
    "uri": "ipfs://QmfAsGExBG8kChweQtZcKZWqUxC4qBYhyWVokE5EQHoyWS",
    "gatewayUrl": "https://sandbox-bc-file.qpyou.cn/ipfs/QmfAsGExBG8kChweQtZcKZWqUxC4qBYhyWVokE5EQHoyWS",
    "metadata": {
      "name": "Arbiter's Robe",
      "description": "desc",
      "image": "https://image01.c2x.world/equip_92053030.gif",
      "animationUrl": "https://image01.c2x.world/equip_92053030.gif",
      "youtubeUrl": "https://www.youtube.com",
      "externalUrl": "https://dex.c2xnft.com/market?key=4423",
      "backgroundColor": "##ffffff",
      "attributes": [
        {
          "traitType": "traitType",
          "maxValue": "10",
          "value": "1",
          "displayType": "displayType"
        }
      ]
    }
  }
}