添加用户
POST /v1/api/user/create
通过此接口开通BW用户。
Name |
Required |
Type |
Description |
x-api-tenantId |
yes |
string |
租户编号 |
x-api-token |
yes |
string |
认证token |
x-language |
no |
string |
语言,zh-CN、en-US |
Request Body Parameters
Name |
Required |
Type |
Description |
email |
yes |
string |
邮箱 |
roleId |
yes |
integer |
用户角色ID |
password |
no |
string |
用户密码,不加密。如果没传则自动生成密码 |
levelId |
no |
integer |
用户层级ID |
parentId |
no |
integer |
上级用户ID |
entityNo |
no |
number |
用户编码,没传则自动生成 |
name |
no |
number |
用户名 |
address |
no |
string |
详细地址 |
phone |
no |
object |
电话数据,见电话数据类型 |
country |
no |
string |
国家ID |
province |
no |
string |
省份ID |
city |
no |
string |
城市ID |
comment |
no |
string |
评论 |
sendEmail |
no |
bool |
是否发送邮件,如果没传密码则肯定发送邮件 |
serverId |
no/如果传了login则必填 |
integer |
账户服务器ID |
login |
no |
integer |
账户ID |
- 电话数据类型
Name |
Type |
Description |
phone |
string |
电话 |
countryCode |
string |
国家码 |
Response
Name |
Type |
Description |
result |
boolean |
成功标识,返回true,表示请求成功,false表示请求失败 |
mcode |
string |
错误码,成功时返回m00000,失败时返回对应的错误码,见文档默认错误码说明 |
data |
object |
报表数据 |
errorMessage |
string |
错误提示信息,部分错误码时有值 |
1、data数据类型
Name |
Type |
Description |
id |
long |
用户ID |
email |
string |
邮箱 |
roleId |
integer |
用户角色ID |
password |
string |
用户密码,不加密。如果没传则自动生成密码 |
levelId |
integer |
用户层级ID |
parentId |
integer |
上级用户ID |
entityNo |
number |
用户编码 |
name |
number |
用户名 |
address |
string |
地址 |
phone |
string |
电话 |
country |
string |
国家ID |
province |
string |
省份ID |
city |
string |
城市ID |
comment |
string |
评论 |
serverId |
integer |
账户服务器ID |
login |
integer |
账户ID |
Example
请求示例
POST /v1/api/suer/create
{
"email":"[email protected]",
"name":"zzz123",
"roleId":1,
"phone":{"countryCode":"+86", "phone":"1888888"},
"levelId":"10",
"parentId":"4"
}
返回示例:成功
{
"data": {
"email": "[email protected]",
"entityNo": "EMIP",
"id": 286,
"levelId": 10,
"name": "zzz123",
"parentId": 4,
"password": "9Bf$5Wj@",
"phone": {
"countryCode": "+86",
"phone": "1888888"
},
"roleId": 1,
"sendEmail": false
},
"mcode": "m0000000",
"result": true
}
返回示例:失败
{
"mcode": "PUB_AUTH_0000007",
"result": false
}
2. Error 错误处理
错误码表(Error Code)
mcode |
MessageBW_API_ |
BW_API_0000001 |
token为空 |
BW_API_0000003 |
无效租户ID |
BW_API_0000004 |
未开通OPENAPI权限 |
PUB_AUTH_0000001 |
邮箱格式错误 |
PUB_AUTH_0000002 |
手机格式错误 |
PUB_AUTH_0000007 |
邮箱邮箱已被注册 |
BW_USER_NAME_NULL |
用户名字为空 |
BW_USER_EMAIL_REPEAT |
用户邮箱重复 |
BW_USER_ENTITYNO_REPEAT |
用户编码重复 |
BW_USER_ROLE_NULL |
用户角色为空 |
-1 |
服务异常,请稍后再试 |