Skip to content

用户 API ​

本页列出当前版本的完整方法及字段。方法通过 gRPC / gRPC-Web 调用;REST 注解不表示已部署 REST Gateway。

“必填:按业务校验”表示 proto3 未声明 required,不代表留空一定可用。UUID、EUI、权限、资源存在性与字段组合由服务端校验。嵌套结构详见页末消息结构。

调用方式、鉴权与错误处理

UserService ​

Create ​

接口名称: api.UserService/Create

功能: 创建 对应资源。Create a new user.

请求: api.CreateUserRequest;返回: api.CreateUserResponse(单次响应)。

请求参数 ​

名称类型必填说明
userapi.User按业务校验用户对象。 User object to create.
passwordstring按业务校验密码。 Password to set for the user.
tenantsrepeated api.UserTenant按业务校验关联租户列表。 Add the user to the following tenants.

返回值 ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID.

错误处理:按 统一错误说明 检查 gRPC 状态;本页不将通用状态码冒充每个方法的固定错误集合。

Get ​

接口名称: api.UserService/Get

功能: 查询 对应资源。Get the user for the given ID.

请求: api.GetUserRequest;返回: api.GetUserResponse(单次响应)。

请求参数 ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID.

返回值 ​

名称类型必填说明
userapi.User按业务校验用户对象。 User object.
created_atgoogle.protobuf.Timestamp按业务校验创建时间。 Created at timestamp.
updated_atgoogle.protobuf.Timestamp按业务校验最后更新时间。 Last update timestamp.

错误处理:按 统一错误说明 检查 gRPC 状态;本页不将通用状态码冒充每个方法的固定错误集合。

Update ​

接口名称: api.UserService/Update

功能: 更新 对应资源。Update the given user.

请求: api.UpdateUserRequest;返回: google.protobuf.Empty(单次响应)。

请求参数 ​

名称类型必填说明
userapi.User按业务校验用户对象。 User object.

返回值 ​

无字段。

错误处理:按 统一错误说明 检查 gRPC 状态;本页不将通用状态码冒充每个方法的固定错误集合。

Delete ​

接口名称: api.UserService/Delete

功能: 删除 对应资源。Delete the user with the given ID.

请求: api.DeleteUserRequest;返回: google.protobuf.Empty(单次响应)。

请求参数 ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID.

返回值 ​

无字段。

操作影响

此方法会删除、清空或重置对应资源/状态。调用前核对目标 ID;请勿通过重试重复执行有副作用的操作。

错误处理:按 统一错误说明 检查 gRPC 状态;本页不将通用状态码冒充每个方法的固定错误集合。

List ​

接口名称: api.UserService/List

功能: 列出 对应资源。Get the list of users.

请求: api.ListUsersRequest;返回: api.ListUsersResponse(单次响应)。

请求参数 ​

名称类型必填说明
limituint32按业务校验本次最多返回条数。 Max number of tenants to return in the result-set. If not set, it will be treated as 0, and the response will only return the total_count.
offsetuint32按业务校验分页起始偏移。 Offset in the result-set (for pagination).

返回值 ​

名称类型必填说明
total_countuint32按业务校验符合条件的总条数。 Total number of users.
resultrepeated api.UserListItem按业务校验结果列表或结果内容。 Result-set.

错误处理:按 统一错误说明 检查 gRPC 状态;本页不将通用状态码冒充每个方法的固定错误集合。

UpdatePassword ​

接口名称: api.UserService/UpdatePassword

功能: 更新 Password。Update the password for the given user.

请求: api.UpdateUserPasswordRequest;返回: google.protobuf.Empty(单次响应)。

请求参数 ​

名称类型必填说明
user_idstring按业务校验用户 UUID。 User ID.
passwordstring按业务校验密码。 Password to set.

返回值 ​

无字段。

错误处理:按 统一错误说明 检查 gRPC 状态;本页不将通用状态码冒充每个方法的固定错误集合。

嵌套消息结构 ​

api.CreateUserRequest ​

名称类型必填说明
userapi.User按业务校验用户对象。 User object to create.
passwordstring按业务校验密码。 Password to set for the user.
tenantsrepeated api.UserTenant按业务校验关联租户列表。 Add the user to the following tenants.

api.CreateUserResponse ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID.

api.DeleteUserRequest ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID.

api.GetUserRequest ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID.

api.GetUserResponse ​

名称类型必填说明
userapi.User按业务校验用户对象。 User object.
created_atgoogle.protobuf.Timestamp按业务校验创建时间。 Created at timestamp.
updated_atgoogle.protobuf.Timestamp按业务校验最后更新时间。 Last update timestamp.

api.ListUsersRequest ​

名称类型必填说明
limituint32按业务校验本次最多返回条数。 Max number of tenants to return in the result-set. If not set, it will be treated as 0, and the response will only return the total_count.
offsetuint32按业务校验分页起始偏移。 Offset in the result-set (for pagination).

api.ListUsersResponse ​

名称类型必填说明
total_countuint32按业务校验符合条件的总条数。 Total number of users.
resultrepeated api.UserListItem按业务校验结果列表或结果内容。 Result-set.

api.UpdateUserPasswordRequest ​

名称类型必填说明
user_idstring按业务校验用户 UUID。 User ID.
passwordstring按业务校验密码。 Password to set.

api.UpdateUserRequest ​

名称类型必填说明
userapi.User按业务校验用户对象。 User object.

api.User ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID (UUID). Will be set automatically on create.
is_adminbool按业务校验平台或当前资源范围管理员标志。 Set to true to make the user a global administrator.
is_activebool按业务校验是否启用。 Set to false to disable the user.
emailstring按业务校验登录身份 / 邮箱。 E-mail of the user.
notestring按业务校验备注。 Optional note to store with the user.

api.UserListItem ​

名称类型必填说明
idstring按业务校验资源 ID。 User ID (UUID).
created_atgoogle.protobuf.Timestamp按业务校验创建时间。 Created at timestamp.
updated_atgoogle.protobuf.Timestamp按业务校验最后更新时间。 Last update timestamp.
emailstring按业务校验登录身份 / 邮箱。 Email of the user.
is_adminbool按业务校验平台或当前资源范围管理员标志。 Set to true to make the user a global administrator.
is_activebool按业务校验是否启用。 Set to false to disable the user.

api.UserTenant ​

名称类型必填说明
tenant_idstring按业务校验租户 UUID。 Tenant ID.
is_adminbool按业务校验平台或当前资源范围管理员标志。 User is admin within the context of the tenant. There is no need to set the is_device_admin and is_gateway_admin flags.
is_device_adminbool按业务校验User is able to modify device related resources (applications, device-profiles, devices, multicast-groups).
is_gateway_adminbool按业务校验User is able to modify gateways.

设备使用指南