NFTRainbow
NFTRainbow 控制台GithubWhat's an NFT?
  • NFTRainbow - NFT 彩虹桥 🌈🌉🦄
  • Tutorials
    • Mints
      • 铸造NFT快速指南
    • Interactive Flowchart
    • By Community
      • NFTRainbow 使用教程
    • Account Solutions
    • Guides
      • 控制台合约代付设置
      • 元数据管理
      • Rainbow 铸造工具简介
  • Docs
    • FAQs
    • Changelog
    • RoadMap
    • Conflux Sponsor
    • Terminology
    • Prices
  • Products
    • Conflux RPC Bridge
    • ERC-6551
    • Web3 Services
  • API Reference
    • Open-API
      • Login
      • Files
      • Metadata
      • Contract
      • Mints
      • Transfers
      • Transaction
      • NFT
      • Burns
    • Swagger-Doc
    • Postman Collection
    • SDKs
      • Go-SDK
    • Common Errors
  • ABOUT THE APIs
    • Authentication
    • Error codes
    • Quotas and rate limits
Powered by GitBook
On this page
  1. API Reference
  2. Open-API

Files

The files APIs provide users to make preparations for creating NFTs including uploading files and the corresponding query functions.

PreviousLoginNextMetadata

Last updated 1 year ago

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.

Name
Meaning
Param Type
Data Type

Authorization

Bearer Token

Header

string

Name
Meaning
Param Type
Data Type
Required

file

uploaded file

multipart/form-data

Name
Meaning
Type

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.

Name
Meaning
Param Type
Data Type

Authorization

Bearer Token

Header

string

Name
Meaning
Param Type
Data Type
Required

file

uploaded file

multipart/form-data

Name
Meaning
Type

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.

Name
Meaning
Param Type
Data Type

Authorization

Bearer Token

Header

string

Name
Meaning
Param Type
Data Type
Required

folder

uploaded files

multipart/form-data

Name
Meaning
Type

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.

Name
Meaning
Param Type
Data Type

Authorization

Bearer Token

Header

string

Name
Meaning
Param Type
Data Type
Required

folder

uploaded files

multipart/form-data

Name
Meaning
Type

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.

Name
Meaning
Param Type
Data Type

Authorization

Bearer Token

Header

string

Name
Meaning
Param Type
Data Type
Required
Default

page

Page Query

query

integer

1

limit

Page Query

query

integer

10

Name
Meaning
Type

count

The number of the uploaded files

integer

items

The files information

[]ExposedFile

The ExposedFile struct is lised as follow:

Name
Meaning
Type

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'

Obtain file list

get

Get the file list containing the info of the files uploaded in the specified app

Query parameters
pagestringOptional

page

limitstringOptional

limit

Header parameters
AuthorizationstringRequired

Bearer openapi_token

Responses
200
OK
application/json
500
Internal Server error
application/json
get
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"
    }
  ]
}
  • Upload File
  • POSTUpload file
  • Upload File to OSS
  • POSTUpload file to OSS
  • Upload File List
  • POSTUpload folder
  • Upload File List To OSS
  • POSTUpload folder to oss
  • Obtain File List
  • GETObtain file list

Upload file

post

Upload a file which can be a video, an image and so on

Header parameters
AuthorizationstringRequired

Bearer openapi_token

Body
filestringRequired

uploaded file

Responses
200
OK
application/json
500
Internal Server error
application/json
post
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"
}

Upload file to OSS

post

Upload a file to OSS, which can be a video, an image and so on

Header parameters
AuthorizationstringRequired

Bearer openapi_token

Body
filestringRequired

uploaded file

Responses
200
OK
application/json
500
Internal Server error
application/json
post
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"
}

Upload folder

post

Upload a folder containing the files which can be a video, an image and so on

Header parameters
AuthorizationstringRequired

Bearer openapi_token

Body
folderstringRequired

uploaded folder

Responses
200
OK
application/json
500
Internal Server error
application/json
post
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"
}

Upload folder to oss

post

Upload a folder containing the files which can be a video, an image and so on, to oss

Header parameters
AuthorizationstringRequired

Bearer openapi_token

Body
folderstringRequired

uploaded folder

Responses
200
OK
application/json
500
Internal Server error
application/json
post
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"
}