Files
The files APIs provide users to make preparations for creating NFTs including uploading files and the corresponding query functions.
Upload File
Upload file API helps users to upload a file to get the corresponding url for creating NFT metadata. The file can be a video, a figure and so on.
Upload a file which can be a video, an image and so on
Bearer openapi_token
uploaded file
OK
Internal Server error
POST /v1/files/ HTTP/1.1
Host: api.nftrainbow.cn
Authorization: text
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 15
"file='text'"{
"file_name": "text",
"file_size": 1,
"file_type": "text",
"file_url": "text"
}Authorization
Bearer Token
Header
string
file
uploaded file
multipart/form-data
file_name
The name of the uploaed file
string
file_size
The size of the uploaed file
integer
file_type
The type of the uploaed file
string
file_url
The url of the uploaed file
string
{
"file_url": "http://dev.nftrainbow/assets/file/1/nft/67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111.jpeg",
"file_size": 11295,
"file_type": "jpeg",
"file_name": "67c96aee8ee1293594a4b4ded15c60ea7853e49c0a2eb41a4805a01a70bc3111"
}curl --request POST \
--url https://api.nftrainbow.cn/v1/files/ \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: multipart/form-data' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form file=Upload File to OSS
OSS is a storage service provided by Alibaba. Users can choose to upload the files to OSS storage. Upload file to OSS API helps users to achieve the target. The file can be a video, a figure and so on.
Upload a file to OSS, which can be a video, an image and so on
Bearer openapi_token
uploaded file
OK
Internal Server error
POST /v1/files/oss HTTP/1.1
Host: api.nftrainbow.cn
Authorization: text
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 15
"file='text'"{
"file_name": "text",
"file_size": 1,
"file_type": "text",
"file_url": "text"
}Authorization
Bearer Token
Header
string
file
uploaded file
multipart/form-data
file_name
The name of the uploaed file
string
file_size
The size of the uploaed file
integer
file_type
The type of the uploaed file
string
file_url
The url of the uploaed file
string
{
"file_url": "https://nft-rainbow.oss-cn-hangzhou.aliyuncs.com/file/4/nft/377d21aaeddfff1f4f1fa73498df70a462945bb06f5a984358202cec0682c4d2.jpeg",
"file_size": 11295,
"file_type": "jpeg",
"file_name": "377d21aaeddfff1f4f1fa73498df70a462945bb06f5a984358202cec0682c4d2"
}curl --request POST \
--url https://api.nftrainbow.cn/v1/files/oss \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: multipart/form-data' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form file=Upload File List
Upload File List API helps users to upload a folder to the server. The files can be a video, a figure and so on.
Upload a folder containing the files which can be a video, an image and so on
Bearer openapi_token
uploaded folder
OK
Internal Server error
POST /v1/files/folder HTTP/1.1
Host: api.nftrainbow.cn
Authorization: text
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 17
"folder='text'"{
"file_num": 1,
"folder_url": "text"
}Authorization
Bearer Token
Header
string
folder
uploaded files
multipart/form-data
file_num
The number of the uploaed file
integer
folder_url
The url of the uploaed folder
string
{
"folder_url": "http://dev.nftrainbow/assets/file/1/nft/e7201e566e70819f09842fba3972c9f0de24d3e57ea667a7b4e3b881d1f4c6fd",
"file_num": 5
}curl --request POST \
--url https://api.nftrainbow.cn/v1/files/folder \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: multipart/form-data' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form file=Upload File List To OSS
Upload File List To OSS API helps users to upload a folder to oss. The files in this folder can be a video, a figure and so on.
Upload a folder containing the files which can be a video, an image and so on, to oss
Bearer openapi_token
uploaded folder
OK
Internal Server error
POST /v1/files/folder/oss HTTP/1.1
Host: api.nftrainbow.cn
Authorization: text
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 17
"folder='text'"{
"file_num": 1,
"folder_url": "text"
}Authorization
Bearer Token
Header
string
folder
uploaded files
multipart/form-data
file_num
The number of the uploaed file
integer
folder_url
The url of the uploaed folder
string
{
"folder_url": "https://nft-rainbow.oss-cn-hangzhou.aliyuncs.com/file/4/nft/377d21aaeddfff1f4f1fa73498df70a462945bb06f5a984358202cec0682c4d2",
"file_num": 5
}curl --request POST \
--url https://api.nftrainbow.cn/v1/files/folder/oss \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: multipart/form-data' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form file=Obtain File List
Obtain file list API helps users to obtain the list including the inforamion of the files uploaded in the specified app. The information of each file contains file_url, file_size, file_type and file_name.
Get the file list containing the info of the files uploaded in the specified app
page
limit
Bearer openapi_token
OK
Internal Server error
GET /v1/files/ HTTP/1.1
Host: api.nftrainbow.cn
Authorization: text
Accept: */*
{
"count": 1,
"items": [
{
"created_at": "text",
"deleted_at": {
"time": "text",
"valid": true
},
"file_name": "text",
"file_size": 1,
"file_type": "text",
"file_url": "text",
"id": 1,
"updated_at": "text"
}
]
}Authorization
Bearer Token
Header
string
page
Page Query
query
integer
1
limit
Page Query
query
integer
10
count
The number of the uploaded files
integer
items
The files information
[]ExposedFile
The ExposedFile struct is lised as follow:
file_name
The name of the uploaed file
string
file_size
The size of the uploaed file
integer
file_type
The type of the uploaed file
string
file_url
The url of the uploaed file
string
{
"count": 3,
"items": [
{
"file_url": "http://dev.nftrainbow/assets/file/2/nft/fa6f733c258e3a0f364aeb18198c9e2bae2e2c91bee4d38a1c88fb9cc8a71a1b.jpeg",
"file_size": 11295,
"file_type": "jpeg",
"file_name": "fa6f733c258e3a0f364aeb18198c9e2bae2e2c91bee4d38a1c88fb9cc8a71a1b"
},
{
"file_url": "http://dev.nftrainbow/assets/file/2/nft/06edf22f414234ea59c949104a054ca4af27cd71e87170d99401b50d15651cdc.jpeg",
"file_size": 11295,
"file_type": "jpeg",
"file_name": "06edf22f414234ea59c949104a054ca4af27cd71e87170d99401b50d15651cdc"
},
{
"file_url": "http://dev.nftrainbow/assets/file/2/nft/bf822838b7b3a7dadc96bd6f38defcbb21376852284ded6302aac69a71e58027.jpeg",
"file_size": 11295,
"file_type": "jpeg",
"file_name": "bf822838b7b3a7dadc96bd6f38defcbb21376852284ded6302aac69a71e58027"
}
]
}curl --request GET \
--url https://api.nftrainbow.cn/v1/files/ \
--header 'Authorization: Bearer {JWT}' \
--header 'Content-Type: application/json'Last updated