用户资源
查询用户信息
1.接口说明
接口路径:/ac/openapi/v2/user
请求方式:GET
请求数据类型:
接口描述:查询平台用户基本信息
2.请求消息
请求参数:
Headers:
名称 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1N... |
3.请求示例
cURL请求示例
shell
curl --location 'https://scnet-demo.accloud.cn/ac/openapi/v2/user' \
--header 'token: <Token>'
Java请求示例
java
import okhttp3.*;
public class getUserInfoDemo {
public static final String TOKEN = "<Token>";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://scnet-demo.accloud.cn/ac/openapi/v2/user")
.method("GET", null)
.addHeader("token", TOKEN)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Python请求示例
python
import requests
url = "https://scnet-demo.accloud.cn/ac/openapi/v2/user"
payload = {}
headers = {
"token": "<Token>"
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
4.响应消息
返回参数
名称 | 类型 | 描述 | 示例 |
---|---|---|---|
msg | string | 信息 | success |
code | string | 状态码 | 0 |
data | object | 用户信息列表 | |
country | string | 国家 | China |
timeZone | string | 时区 | (UTC+0800) China Standard Time |
language | string | 语言 | |
userName | string | 用户名 | test |
fullName | string | 全名 | 测试用户 |
address | string | 地址 | 测试地址 |
accountStatus | String | 账户状态 | Normal |
accountName | string | 账户名称 | test |
accountBalance | string | 账户余额 | 0.00 |
computerCenter | string | 区域 | OpenAPI计算中心 |
返回示例:
json
{
"code":"0",
"msg":"success",
"data":{
"country":"China",
"language":"zh_CN",
"timeZone":"(UTC+0800) China Standard Time",
"address":"测试地址",
"fullName":"测试用户",
"userName":"test",
"computerCenter":"OpenAPI计算中心",
"accountName":"test",
"accountStatus":"Normal",
"accountBalance":"0.00"
}
}
5.错误码
错误码 | 说明 |
---|---|
10001 | 内部错误 |
10003 | 参数不全 |
10004 | 参数无效 |
10008 | 权限不足 |
10009 | 没有权限访问接口 |
10014 | 配额设置失败 |
601006 | 平台用户名已经存在, 请修改用户名重新尝试 |
622132 | 查询不到当前用户组管理员在计算中心下的用户组信息 |
622115 | 用户组名额已达上限,请申请增加用户组名额 |
0 | 接口调用成功 |