Asset API offers registering and retrieving information about assets like media files.

Upload Asset

Uploads assets (the media files like jpg, png, gif, etc.) to the public IPFS (InterPlanetary File System). It offers the address (uri) of the uploaded asset IPFS and the gateway address (gatewayUrl) that can be accessed via HTTP.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/asset
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/asset
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
asset the binary information about the media file to be uploaded string Y

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 asset was uploaded string
data.gatewayUrl the gateway address where the asset can be found string

Request Sample

Response Sample

Upload Asset with Public URL

Uploads assets (the media files like jpg, png, gif, etc.) to the public IPFS. Instead of uploading the files directly, upload them via the public URL. It offers the address (uri) of the uploaded asset IPFS and the gateway address (gatewayUrl) that can be accessed via HTTP.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/asset-by-url
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/asset-by-url
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
url the public URL to which the asset will be uploaded string Y

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 asset was uploaded string
data.gatewayUrl the gateway address where the asset can be found string

Request Sample

Response Sample

Get Asset Information

Gets the asset URL, open to public, via the content identifier (cid).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/asset/{cid}
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/asset/{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 API response data json
data.assetUri the gateway address where the asset can be found string

Request Sample

Response Sample