文档

人员账号服务API

更新时间:
一键部署

1. 概述

创建人员统一身份id(identifyID)

2. 接口定义

2.1 注销账号

路径

/user/account/unregister

版本号

1.0.1

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

3000

请求参数

名称

类型

是否必选

描述

identityId

String

需要注销的统一身份ID。

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.1");
// 设置参数
request.putParam("identityId","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/user/account/unregister", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
  "id": "8d1a665e-ce92-45bf-add8-99d2e818****",
  "code": 200,
  "message": null,
  "localizedMsg": null,
  "data": ""
}

异常返回示例:

{
  "id": "8d1a665e-ce92-45bf-add8-99d2e818****",
  "code": 460,
  "message": "identityId is blank!",
  "localizedMsg": null,
  "data": null
}

错误码:

错误码

错误信息

错误描述

460

identityId is blank

需要注销的账号不存在。

2.2 账号注册

路径

/user/account/register

版本号

1.0.2

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

3000

请求参数

名称

类型

是否必选

描述

loginName

String

登录名

phone

String

手机号

email

String

邮件地址

nickName

String

用户昵称

password

String

密码

avatarUrl

String

头像url

creater

String

创建者

mobileLocationCode

String

手机国际区号

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

String

统一身份identityId,即为创建员工的accountId。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.2");
// 设置参数
request.putParam("loginName","value1");
request.putParam("phone","value2");
request.putParam("email","value3");
request.putParam("nickName","value4");
request.putParam("password","value5");
request.putParam("avatarUrl","value6");
request.putParam("creater","value7");
request.putParam("mobileLocationCode","value8");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/user/account/register", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
  "id": "f1ed2f40-a02e-4b20-a691-21bc3cb17707",
  "code": 200,
  "message": null,
  "localizedMsg": null,
  "data": "505fop357f0d8299b92664fc91012ae88ed25269"
}

异常返回示例:

{
  "id": "f1ed2f40-a02e-4b20-a691-21bc3cb17707",
  "code": 2404,
  "message": "手机格式不正确",
  "localizedMsg": null,
  "data": null
}

错误码

错误码

错误信息

错误描述

2402

registerAccount failed

账号注册失败

2404

oa error message

手机号格式不正确

2.3 账号冻结

路径

/user/account/freeze

版本号

1.0.1

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

3000

请求参数

名称

类型

是否必选

描述

identityId

String

统一身份id

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.1");
// 设置参数
request.putParam("identityId","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/user/account/freeze", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
  "id": "8d1a665e-ce92-45bf-add8-99d2e81814f3",
  "code": 200,
  "message": null,
  "localizedMsg": null,
  "data": ""
}

异常返回示例:

{
  "id": "8d1a665e-ce92-45bf-add8-99d2e81814f3",
  "code": 460,
  "message": "identityId is blank!",
  "localizedMsg": null,
  "data": null
}

错误码

错误码

错误信息

错误描述

460

identityId is blank

冻结的账号不存在

2.4 账号解冻

路径

/user/account/unfreeze

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

3000

请求参数

名称

类型

是否必选

描述

identityId

String

统一身份id

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
request.putParam("identityId","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/user/account/unfreeze", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止"
}

错误码

错误码

错误信息

错误描述

403

request forbidden.

请求被禁止

2.5 根据手机号查找账号信息

路径

/user/account/querybyphone

版本号

1.0.1

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

3000

请求参数

名称

类型

是否必选

描述

phone

String

手机号

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果

响应结果 data:

名称

类型

描述

identityId

String

账号id

loginId

String

openaccount Id

loginName

String

登录名

phone

String

手机号

email

String

邮箱地址

nickName

String

昵称

creater

String

创建者

modifier

String

修改者

createAppKey

String

创建appkey

avatarUrl

String

头像地址

phoneLocationCode

String

手机号国家区号

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.1");
// 设置参数
request.putParam("phone","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/user/account/querybyphone", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": {
        "createAppKey": "25214645",
        "creater": "郑士林",
        "identityId": "50b7op6575e3453gd345290b4aa7480174495",
        "loginId": "27921931",
        "nickName": "abc",
        "phone": "180274*****"
    }
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
    "code": 403,
    "message": "request forbidden.",
    "localizedMsg": "请求被禁止",
    "data": null
}

错误码

错误码

错误信息

错误描述

403

request forbidden.

请求被禁止

  • 本页导读 (0)
文档反馈