跳到主要内容

API 合集汇总

API 汇总

提示

本文档是 API 文档的汇总,囊括除登录授权、积分支付、区块链转账外的所有接口,每个API可以点击左上角的三角号展开详情。

如有任何问题,欢迎加入DeBox技术讨论群:点击加入

消息推送

POSThttps://open.debox.pro/openapi/messages/group/send

向群组发文字消息,调用示例:

curl -X POST -H "Content-Type: application/json" \
-H "X-API-KEY: t2XAlEF6......" \
-d '{"to_user_id":"uvg2p6ho","group_id":"fxi3hqo5",\
"object_name":"text","content":"i am message sent by bot"}' \
"https://open.debox.pro/openapi/messages/group/send"

Parameters

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

group_id : String 群组的group_id。代表往哪个群组发消息,非空

to_user_id : String 用户的userid。代表@群组的哪个用户,可为空

object_name : String 代表消息类型,文字消息,必须为text

content : String 文字消息字符串,非空

Responses

200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}

POSThttps://open.debox.pro/openapi/messages/group/send

向群组发图片文字消息,从上到下排版顺序为图片、title、content、图片,其中content为富文本,可以插入任意超链接。调用示例:

  curl -X POST -H "Content-Type: application/json" \
-H "X-API-KEY: t2XJ........lEF6" \
-d '{"group_id":"l3ixp32y","object_name":"richtext","title":"我是标题","content":"i am 富文本 \
{\"uitag\":\"a\",\"text\":\"点击我\",\"href\":\"https://debox.pro/\"}将跳转"}' \
"https://open.debox.pro/openapi/messages/group/send"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

group_id : String 群组的group_id。代表往哪个群组发消息,非空

to_user_id : String 用户的userid。代表@群组的哪个用户,可为空

object_name : String 代表消息类型,图片文字消息,必须为richtext

title : String 代表图文消息的文字标题

content : String 代表图文消息的主体部分,为富文本,可以插入超链接和图片


1、超链接
示例: {"uitag":"a","text":"DeBox","href":"https://debox.pro/deswap"}
uitag为a时,表示一个超链接。
将以下 json 转成字符串,拼接到content里,界面上将显示一个热点区域"DeBox",点击后跳转至https://debox.pro/deswap
var uiA = {
uitag: "a",
text: "DeBox",
href: "https://debox.pro/deswap",
}


2、彩色文字
示例: {"uitag":"font","text":"15%","bold":"true","italic":"true","color":"#ff0000"}
uitag为font时,表示彩色文字,支持加粗(true/false)、斜体(true/false)、颜色(RGB格式)。
将以下 json 转成字符串,拼接到content里,界面上将显示加粗、斜体、蓝色的"15%"
var uiFont = {
Uitag: "font",
Text: "15%",
Color: "#0000ff",
Bold: "true",
Italic: "true",
}


3、图片
示例:{"uitag":"img","src":"https://domain.com/a.png","position":"foot","height":"500","href":""}
用法:将以下json转字符串后拼接到content里
var uiImg = UITagImg{
Uitag: "img",
Src: "<https://data.debox.space/dao/newpic/two.png>",
Position: "foot",
Href: "<https://www.baidu.com>",
Height: "500",
}
uitag=”img” ,则表示是一副图片
src:图片地址,为空时只显示占位
position: 显示位置
为head时,图片显示在顶部,在title的前面
为foot时,图片显示在底部
为其他时,隐藏图片不显示任何东西
href点击后的跳转页面
为DeBox白名单地址时,直接打开
为非白地址时,则弹提示警告框
为空、或者没有定义时,显示放大的图片
width、height表示图片的宽高
img的width,默认值为消息排版的最大宽度;
img的height,默认值也为消息排版的最大宽度;
width、height支持%, 参考系为消息排版的最大宽度。


3、一个 content 的例子:
项目名称 成交量
{"uitag":"a","text":"DeBox","href":"https://debox.pro/deswap"} 96.78k
{"uitag":"font","text":"15%","bold":"true","italic":"true","color":"#ff0000"}
{"uitag":"img","src":"https://domain.com/a.png","position":"foot","height":"500","href":""}

显示样例: 纯文字:
alt text
上图下文
alt text
上文下图:
alt text
上图中文下图:
alt text

Responses

200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}

POSThttps://open.debox.pro/openapi/messages/private/send

向私人发消息,调用示例:


curl -X POST -H "Content-Type: application/json" \
-H "X-API-KEY: t2XAlEF6......" \
-d '{"to_user_id":"uvg2p6ho","object_name":"text","content":"i am message"}' \
"https://open.debox.pro/openapi/messages/private/send"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

to_user_id : String 用户的userid。代表消息的接受者,非空

object_name : String 代表消息类型,值可为text或richtext,具体参考上文

content : String 根据object_name值,同上文对应参数设定

Responses

200: OK
{
"code":200,
"data":null,
"message":"success",
"success":false
}
获取用户昵称、头像及钱包地址等用户信息

POSThttps://open.debox.pro/openapi/user/info

获取某个用户基础信息,POST请求方式,用access_token做鉴权
该接口配合登录授权使用、授权完成后,用获得的access_token和user_id请求本接口获取用户的基础信息,如昵称、头像、钱包地址等。
使用示例:

curl --location --request POST 'https://open.debox.pro/openapi/user/info?user_id=lx....' \
--header 'access_token: eyJhxxCJ9.eyxxJ9.hWxxQ'

Parameters

Query

user_id : String 在登录授权获得的user_id

access_token : String 登录授权阶段获得的用户access_token

Responses

200: OK
{
"code": 1,
"data": {
"name": "ltx", // 用户昵称
"wallet_address": "0xsadf......34df", // 钱包地址
"avatar": "https://data.debox.space/nfts/0x67a7f09c/699-1.png",// 头像地址
"uid": "fxidfef4" // 用户id和 user_id一样
"level": 3, // 用户等级
"level_icon": "https://data.debox.space/nfts/0x67a7f09c/699-1.png", // 用户等级图片

},
"message": "成功",
"success": true
}

GEThttps://open.debox.pro/openapi/user/info

获取某个用户基础信息,GET请求方式,用X-API-KEY做鉴权,是POST方式的简化版,此接口未来会废弃,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/user/info?user_id=uvg2p6ho"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

user_id : String 用户的userid。在登录授权时可以获得授权用户的userid

Responses

200: OK
{
"code": 1,
"data": {
"name": "ltx", // 用户昵称
"wallet_address": "0xsadf......34df", // 钱包地址
"avatar": "https://data.debox.space/nfts/0x67a7f09c/699-1.png",// 头像地址
"uid": "fxidfef4" // 用户id和 user_id一样
"level": 3, // 用户等级
"level_icon": "https://data.debox.space/nfts/0x67a7f09c/699-1.png", // 用户等级图片

},
"message": "成功",
"success": true
}

GEThttps://open.debox.pro/openapi/user/followers

被关注列表。获取开发者账号绑定的DeBox用户的被关注列表,即关注开发者的用户列表:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/user/followers?page=1&size=20"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

page : Numeric 分页查询的页数

size : Numeric 分页查询每页的大小

Responses

200: OK
{
"code": 1,
"data": [
{
"name": "zhang3",
"wallet_address": "0x22b15300cf8...2562bea2",
"avatar": "https://data.debox.pro/.../headimg.png",
"uid": "0mb...bc"
},
{
"name": "Lee4",
"wallet_address": "0xb63219a8e0d3...f2cd459f",
"avatar": "https://data.debox.pro/.../headimg.png",
"uid": "xq6...pg"
}
],
"message": "success",
"success": true
}

POST https://open.debox.pro/openapi/user/followers

被关注列表。即授权用户的粉丝,POST请求方式,用access_token做鉴权
使用示例:

curl --location --request POST 'https://open.debox.pro/openapi/user/followers?user_id=lx...' \
--header 'access_token: eyJhbGciOi...'

Parameters

Query

user_id : String 在登录授权获得的user_id

page : Numeric 分页查询的页数

size : Numeric 分页查询每页的大小

Header

access_token : String 登录授权阶段获得的用户access_token

Responses

200: OK
{
"code": 1,
"data": [
{
"name": "zhang3",
"wallet_address": "0x22b15300cf8...2562bea2",
"avatar": "https://data.debox.pro/.../headimg.png",
"uid": "0mb...bc"
},
{
"name": "Lee4",
"wallet_address": "0xb63219a8e0d3...f2cd459f",
"avatar": "https://data.debox.pro/.../headimg.png",
"uid": "xq6...pg"
}
],
"message": "success",
"success": true
}

GEThttps://open.debox.pro/openapi/user/is_follow

查询某用户是否关注另一个用户,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/user/is_follow?\
walletAddress=0x2267......&chain_id=1&followAddress=0xB63219a8E0D367d87BA1c8B0736CbfDbf2cD459F"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

walletAddress : 关注者的钱包地址

followAddress : 被关注者的钱包地址

Responses

200: OK
{"case3702":false}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}
401: Unauthorized
{"error":"Bad Request","code":401,"message":"Param error"}
社区(群组)信息

GEThttps://open.debox.pro/openapi/group/info

获取当前群组信息,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......"  \
"https://open.debox.pro/openapi/group/info?\
group_invite_url=https://m.debox.pro/group?id=fxi3hqo5"

Parameters

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

group_invite_url : 群组分享 url,在 app 端,点击群分享,复制链接即可获得

Responses

200: OK
# is_charge 检查是否为PayEClub
# subchannel_number 子频道数量
# group_name 群组名称
# group_number 群组人数
# group_pic 群封面图
# create_time 创建时间
# maximum 最大群组人数上限
# mod MOD名称
{
"code": 200,
"data": {
"is_charge": true,
"subchannel_number": 3,
"group_name": "aaa",
"group_number": 29,
"group_pic": "https://data.debox.pro/static/2022/09/19/static/2022/09/19/100009_1435000131.jpg",
"create_time": "2022-04-30 16:03:24",
"maximum": "500",
"mod_info":[{"name":"ChatBot","wallet_address":"0xb63219a8e0d367d87ba1c8b0736cbfdbf2cd459f","avatar":"https://data.debox.pro/static/2024/03/29/uvg2p6ho/1711724284264837135.jpeg","uid":"uvg2p6ho"}]
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

GEThttps://open.debox.pro/openapi/group/is_join

验证用户是否加入了某群组,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/group/is_join?\
walletAddress=0x2267......&url=https://m.debox.pro/group?id=fxi3hqo5"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

walletAddress : 钱包地址,代表要验证的用户

url : 群组分享URL ,代表某个群,在群组聊天页面,点击右上角的分享,点击“复制链接”获得

chain_id : 区块链网络ID,默认值1,以太坊主网

Responses

200: OK
{"case3701":false}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}
401: Unauthorized
{"error":"Bad Request","code":401,"message":"Param error"}
动态、点赞、用户间的关注关系

GEThttps://open.debox.pro/openapi/moment/praise_info

获取钱包地址对应用户发的所有动态获得的点赞信息,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/moment/praise_info?\
wallet_address=0x2267......&chain_id=1"

Parameters

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

wallet_address : 钱包地址,代表某个用户

chain_id : 区块链网络ID,默认值1,以太坊主网

Responses

200: OK
# receive_praise_total 自己获得的点赞总数
# send_praise_total 给别人点赞的总数
{
"code": 1,
"data": {
"receive_praise_total": 46,
"send_praise_total": 208
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

GEThttps://open.debox.pro/openapi/moment/give_praise

判断某个用户是否给某条动态点赞,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/moment/give_praise?\
wallet_address=0x2267......&chain_id=1&moment_id=oo0epx1p"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

wallet_address : 钱包地址,代表某个用户

chain_id : 区块链网络ID,默认值1,以太坊主网

moment_id : 动态ID,代表某个动态

Responses

200: OK
# is_praise 是否已点赞
{
"code": 1,
"data": {
"is_praise": false
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

GEThttps://open.debox.pro/openapi/moment/receive_praise

获取某个动态点赞总数、以及所有点赞用户,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/moment/receive_praise?moment_id=oo0epx1p"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

moment_id : 动态ID,代表某个动态

Responses

200: OK
# receive_praise_total  被点赞数
{
"code": 1,
"data": {
"receive_praise_total": 1
"praise_users":[{"name":"xxx","wallet_address":"0x3e52...","avatar":"https://data...png","uid":"0yz..."}]
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}
投票、抽奖

GEThttps://open.debox.pro/openapi/vote/info

获取钱包地址用户在某群组的投票数量

Parameters

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

wallet_address : 钱包地址,代表某个用户

chain_id : 区块链网络ID,默认值1,以太坊主网

group_invite_url : 群组分享url,代表某个群组

Responses

200: OK
# vote_number  投票数量
{
"code": 200,
"data": {
"vote_number": 6//投票数量
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

GEThttps://open.debox.pro/openapi/lucky_draw/info

获取钱包地址用户在某群组的抽奖数量

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

wallet_address : 钱包地址,代表某个用户

chain_id : 区块链网络ID,默认值1,以太坊主网

group_invite_url : 群组分享url,代表某个群组

Responses

200: OK
# initiate_luckDraw_total 发起抽奖总次数
# luckDraw_total 参与抽奖总次数
# luckDraw_win_total 中奖总次数
{
"code": 1,
"data": {
"initiate_luckDraw_total": 3,
"luckDraw_total": 3,
"luckDraw_win_total": 3
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}
红包

GEThttps://open.debox.pro/openapi/lucky_box/user

获取钱包地址用户收/发的红包信息

Parameters

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

wallet_address : 钱包地址,代表某个用户

chain_id : 区块链网络ID,默认值1,以太坊主网

Responses

200: OK
# receive_luckyBox_number  领取红包个数
# receive_luckyBox_total 领取红包数量(金额)
# send_luckyBox_number 发送红包个数
# send_luckyBox_total 发送红包数量(金额)
{
"code": 1,
"data": {
"receive_luckyBox_number": 12,
"receive_luckyBox_total": 1235.9,
"send_luckyBox_number": 18,
"send_luckyBox_total": 3199.58
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

GEThttps://open.debox.pro/openapi/lucky_box/user/group

某个用户在特定群组领取红包的数目

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

wallet_address : 钱包地址,代表某个用户

chain_id : 选择要从中获取数据的区块链网络

group_invite_url : 群组分享url,代表某个群组

Responses

200: OK
# receive_luckyBox_number  领取红包数量
{
"code": 1,
"data": {
"receive_luckyBox_number": 8//领取红包数量
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}

GEThttps://open.debox.pro/openapi/lucky_box/group

获取当前群组发放红包总量,使用示例:

curl -X GET -H "X-API-KEY: t2XAlEF6......" \
"https://open.debox.pro/openapi/lucky_box/group?\
group_invite_url=https://m.debox.pro/group?id=fxi3hqo5"

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Query

group_invite_url : 群组分享 url ,代表某个群

Responses

200: OK
# sum_amount 发送vBOX数量
# total_num 发送的个数
{
"code": 200,
"data": {
"sum_amount": 3896,
"total_num": 30
},
"message": "success",
"success": true
}
400: Bad Request
{"error":"Bad Request","code":400,"message":"You X-API-KEY is not available"}
授权登录

DeBox授权登录是基于OAuth2.0 协议标准构建的登录系统,详细介绍

GEThttps://app.debox.pro/oauth/authorize

在DeBox App中,点击该链接,跳转至授权界面,用户在该界面点击允许或取消。用户允许授权后,页面会跳转到重定向地址,并携带 code & userId & sourse

https://app.debox.pro/oauth/authorize/?
app_id=ohpdAP9W55gyXeJ0&grant_type=authorization_code&scope=userinfo&response_type=code&
pay_info=loginTest&redirect_uri=https://docs.debox.pro/demo/a.html

Parameters

Query

redirect_uri : String 授权成功后的回调地址。当用户点击授权后,app会将获得的code作为参数回调该地址。 ,需要用encodeURIComponent编码,必须是白名单下的地址,请先配置App Domain

app_id : String 应用唯一标识,DeBox开放平台申请

scope : String 授权域:userinfo代表用户信息授权 moment代表打赏信息授权

grant_type : String 表示授权方式是授权码:authorization_code

GEThttps://open.debox.pro/openapi/oauth2/access_token

获取第一步的 code 后,请求以下链接获取 access_token:

  curl --location --request GET
https://open.debox.pro/openapi/oauth2/access_token?
grant_type=authorization_code&code=ZDY5ZTA......FRE5
&app_id=xxxxxx&app_secret=xxxxxx&user_id=xxxxxx

Parameters

Query

grant_type : String 表示授权方式是授权码:authorization_code


code : String 第一步获取的 code

app_id : String 应用唯一标识,DeBox开放平台申请

app_secret : String 开放平台申请的app_secret

user_id : String 授权用户的user_id

Responses

200: OK
  {
"code": 1,
"data": {
"access_token":
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODgzOTQ4MDMsInN1YiI6IjEwMzA1O
CJ9.hbEt8JthQvo85iGkhUiPpTlcII4n3hgOYDErUDS9X2kkOnsNM27pAO_x9WP4KEE_33uFEd6GOgS
A51MlYZakb1",
"expires_in": 1,
"refresh_token": "MDBMOWYZYWYTZMRLYS01ODRHLWJKYTUTZGFIMMU1ZDEZNWM3",
"token_type": ""
},
"message": "success",
"success": true
}
401: Failed
  { 
"code": 401,
"message": "Bad Request",
"success": false
}

GEThttps://open.debox.pro/openapi/oauth2/refresh_token

刷新access_token

curl --location --request GET
https://open.debox.pro/openapi/oauth2/refresh_token?
grant_type=refresh_token&refresh_token=YTNMYMZJZMY......ZTAH
&app_id=xxxxxx&app_secret=xxxxxx&user_id=xxxxxx

Parameters

Query

grant_type : String 表示授权方式是授权码:refresh_token


refresh_token : String 第二步获取的 refresh_token

app_id : String 应用唯一标识,DeBox开放平台申请

app_secret : String 开放平台申请的app_secret

user_id : String 授权用户的user_id

Responses

200: OK
  {
"code": 1,
"data": {
"access_token":
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODgzOTQ4MDMsInN1YiI6IjEwMzA1O
CJ9.hbEt8JthQvo85iGkhUiPpTlcII4n3hgOYDErUDS9X2kkOnsNM27pAO_x9WP4KEE_33uFEd6GOgS
A51MlYZakbg",
"expires_in": 1,
"refresh_token": "MDBMOWYZYWYTZMRLYS01ODRHLWJKYTUTZGFIMMU1ZDEZNWM3",
"token_type": ""
},
"message": "success",
"success": true
}
401: Failed
 {
"code": 401,
"message": "Bad Request",
"success": false
}
授权支付

DeBox 提供了基于 vBOX 的支付授权接口,为 vBOX 提供更广阔的应用场景。

GEThttps://app.debox.pro/oauth/authorize

⼀次性 token 请求接⼝,该接口用来生成积分支付的订单号和 token,和下面的/payment/transfer 接口联合使用完成积分支付功能。

https://app.debox.pro/oauth/authorize?
app_id=ohpdAP9W55gyXeJ0&scope=payment&grant_type=onetime_token&amount=0.01&
payer_user_id=ii0k2v5n&receiver_user_id=rqg6g4j1&pay_type=send&pay_info=test&
redirect_uri=https://docs.debox.pro/demo/a.html

Parameters

Query

redirect_uri : String 授权成功跳转链接,需要用encodeURIComponent编码,必须是白名单下的地址,请先配置App Domain

app_id : String 应用唯一标识,DeBox开放平台申请

scope : String 授权范围(payment)

grant_type : String 授权类型(onetime_token)

amount : Number 金额,最多两位小数

payer_user_id : String 付款方user_id,必须为授权用户的user_id

receiver_user_id : String 收款方user_id,必须为商家的user_id

pay_type : String 必须为send,代表授权用户是付款方

pay_info : String 转账信息,用于提示支付的场景

Responses

200: OK
{ 
"code": "xxx", // 授权token,⽤于转账请求 有效期5分钟
"serial_id": "xxx", // 订单号
"source ": "debox" // 来源
}

POSThttps://open.debox.pro/openapi/payment/order

商家付款接⼝,该接口用来生成积分支付的订单号和 token,和下面的/payment/transfer 接口联合使用完成积分支付功能。
该接口只用作商家支付场景,无需弹框授权;上面oauth/authorize接口使用场景为用户支付给商家,需要弹框授权

Parameters

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Body

payer_user_id : String 支付方user_id,即商家user_id

receiver_user_id : String 收款方user_id

amount : String 金额,最多两位小数,数字字符串

Responses

200: OK
{ 
"access_token": "xxx", // 授权token,⽤于转账请求 有效期5分钟
"serial_id": "xxx", // 订单号
"amount": "10", //下单金额
}

POSThttps://open.debox.pro/openapi/payment/transfer

转账接口

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Body

access_token : String 授权得到的code

serial_id : String 授权得到的流水号(订单号)

verify_amount : String 当开发者是支付方时,该值是必填项,用于校验开发者所需支付金额是否正确,若和授权阶段的金额不一致,则转账失败

Responses

200: OK
{ 
"code": "", // 错误码,1为成功
"msg": "",
"source ": "debox" // 来源
}

POSThttps://open.debox.pro/openapi/payment/assert/vbox

查询商家vBOX余额。

Parameters

Header

app_id : String 应用唯一标识,DeBox开放平台申请

X-API-KEY : String 开发者 key,在开放平台可以获取

nonce : String 随机数字,长度 8 位

timestamp : String 时间戳,精确到毫秒

signature : String sha1 计算的签名,需严格按照 签名 计算规则

签名计算,需要用与 X-API-KEY 对应的 App Secret 对随机数和时间戳进行签名

// 顺序必须必须严格按:appsecret -> nonce -> timestamp
signature = SHA1({appsecret}{nonce}{timestamp})
Body

无,查询app_id对应的商家vBOX资产

Responses

200: OK
{ 
"total": xxx, //总资产
"usable_balance": xxx, // 可用资产
}
API 错误码

-2001 ⽤户登录有效性问题,可尝试重新登录
-2004 参数不合法
-2006 交易参数不合法
-2010 获取 access token,code 过期
-2011 获取 access token,无效 code
-2012 刷新 access token 失败
-2013 access token 过期
-2014 系统异常,请重试
-2015 access token 校验失败
-2016 重复发起转账请求
-2028 系统异常,请重试
-2030 系统异常,请重试
-7048 余额不⾜,转账失败
-7052 系统异常,请重试

Shares协议

DeBox 提供了 Shares 分佣协议,以激励更多的用户参与分享、推广和使用小程序。详细介绍

提供有以下方法:

  1. vBOX 支付接入 Shares
  • DeBox Wallet SDK: DAPP 与 DeBox 钱包进行连接和交互的工具。

  • eth_requestAccounts:请求用户钱包授权连接。

  • wallet_requestPermissions:用于请求用户批准 DAPP 某些访问权限,如debox_getUserInfodebox_getVBoxBalance

  • debox_getUserInfo:获取用户的公开信息,如用户 ID、钱包地址、昵称和头像。

  • debox_getVBoxBalance :获取用户的 vBOX 余额

  • debox_paymentVBox:用户进行 vBOX 支付,可指定收款地址、支付金额、支付备注和分佣金额。

  • https://open.debox.pro/openapi/payment/receipt :查询用户debox_paymentVBox的结果

  1. 链上支付接入 Shares
  • 提供有链上原生代币(ETH)支付分佣、ERC20代币支付分佣的 Shares 合约方法接口