查询余额接口
接口概述
用于查询当前用户的账户余额。
| 网络协议 | 请求地址 | 请求方法 | 鉴权方式 | 请求格式 | 响应格式 |
|---|---|---|---|---|---|
| HTTP | /open-api/v1/balance | GET | Bearer | application/json | application/json |
请求头(Headers)
| 参数名称 | 值 | 描述 |
|---|---|---|
| Content-Type | application/json | 数据交换格式 |
| Authorization | Bearer | 将{accessToken}替换为您上面接口获取的accessToken |
json
Authorization: Bearer <accessToken>
Content-Type: application/json请求参数(HTTP GET)
无
响应体(Response)
| 参数名称 | 子字段 | 类型 | 描述 |
|---|---|---|---|
| code | - | String | 错误码,具体见错误码表 |
| data | totalBalance | Decimal | 总余额 |
| msg | - | String | 具体错误信息 |
json
{
"code": 200,
"msg": "success",
"data": {
"totalBalance": 14.00
}
}错误码(Error Code)
错误码按照JSON structure返回,包括code和msg字段;随着版本更新,我们会扩展对应字段的值
json
{
"code": 401,
"data": {},
"msg": "Unauthorized"
}请求示例(Shell & Python)
Shell
shell
curl --location --request GET 'https://api.hitem3d.ai/open-api/v1/balance' \
--header 'Authorization: Bearer <accessToken>' \
--header 'Content-Type: application/json'Python
python
import requests
url = "https://api.hitem3d.ai/open-api/v1/balance"
payload={}
headers = {
'Authorization': 'Bearer <accessToken>',
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)