Get User Information¶
获取当前用户的信息。
操作权限¶
用户需要登录 Application Portal。
请求格式¶
GET https://{apigw-address}/app-portal-service/v2.2/user/info
请求参数(Header)¶
名称 | 必需/可选 | 数据类型 | 描述 |
---|---|---|---|
Authorization | 必需 | String | Access Token,以Bearer Token表示,需要通过调用 Log In 或 Refresh Access Token 接口后获取。 |
响应参数¶
名称 | 数据类型 | 描述 |
---|---|---|
data | data结构体 | 用户信息。 |
data结构体¶
名称 | 数据类型 | 描述 |
---|---|---|
id | String | 用户的ID。 |
name | String | 用户名。 |
domain | String | 域名称。 |
description | String | 用户描述。 |
nickName | String | 用户昵称。 |
phoneArea | String | 用户注册电话的区号。 |
phone | String | 用户的注册手机号码。 |
String | 用户的注册邮箱。 | |
createdTime | String | 用户账户创建时间。 |
joinTime | String | 用户加入当前组织的时间。 |
type | Integer | 用户类型,0:App Portal账号,1:第三方域账号。 |
错误码¶
代码 | 描述 |
---|---|
31401 | 提供的Access Token无效 |
示例¶
请求示例¶
url: https://{apigw-address}/app-portal-service/v2.2/user/info
method: GET
headers: {"Authorization":"Bearer APP_PORTAL_S_TDKKeqfYBK3m5z3LRgKVqThWDYnRBN44"}
返回示例¶
{
"code": 0,
"message": "OK",
"data": {
"id": "yourUserId",
"name": "portal_demo",
"domain": "",
"description": "",
"nickName": "",
"phoneArea": "",
"phone": "",
"email": "1@163.com",
"createdTime": "2019-05-27 04:33:30.0",
"type": 0
}
}
Java SDK 调用示例¶
public class AppPortalSdkTest{
@Test
public void getUserInformationTest() {
UserInfoRequest userInfoRequest = new UserInfoRequest("your_access_token");
UserInfoResponse userInfoResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
.url("https://{apigw-address}").getResponse(userInfoRequest, UserInfoResponse.class);
System.out.println("User Information res: " + JSON.toJSONString(userInfoResponse));
assertNotNull("Response should not be null", userInfoResponse);
assertNotNull("Response data should not be null", userInfoResponse.data);
assertNotNull("User id could not be null", userInfoResponse.data.id);
}
}