
# 添加用户 - AddUser
#### 描述
企业管理员通过该接口添加企业用户。
![](https://support.huaweicloud.com/api-meeting/public_sys-resources/note_3.0-zh-cn.png)
默认添加用户后，用户第一次登录华为云会议App或者Portal时需要修改密码。若需关闭第一次登录修改密码，请联系华为销售人员，并提供华为云会议企业ID。
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=Meeting&api=AddUser)中调试该接口。
#### URI
POST /v1/usg/dcs/corp/member
#### 请求参数
表1参数说明 
| 参数              | 是否必须 | 类型                                                                    | 位置     | 描述                                                                                                                                                                                                                                                                                                                                       |
|:---|:---|:---|:---|:---|
| X-Access-Token  | 是    | String                                                                | Header | 授权令牌。获取"[执行App ID鉴权](https://support.huaweicloud.com/api-meeting/meeting_21_0311.html)"响应的accessToken。                                                                                                                                                                                                                                   |
| X-Request-Id    | 否    | String                                                                | Header | 请求requestId，用来标识一路请求，用于问题跟踪定位，建议使用UUID，若不携带，则后台自动生成。                                                                                                                                                                                                                                                                                     |
| Accept-Language | 否    | String                                                                | Header | 语言参数，默认为中文zh-CN，英文为en-US。                                                                                                                                                                                                                                                                                                                |
| account         | 否    | String                                                                | Body   | 华为云会议用户账号，若携带则以携带为准，否则后台自动生成。账号整系统唯一。 账号只能包含大小写字母、数字、_、-、.、@符号，不能为纯数字和@后面带.号。 maxLength：64 minLength：0 说明： 账号/密码鉴权方式时需要填写。 |
| thirdAccount    | 否    | String                                                                | Body   | 第三方User ID。第三方User ID需要企业内唯一。 说明： App ID鉴权方式时需要填写。                                                                                                                                                                                                     |
| country         | 否    | String                                                                | Body   | [手机号所属的国家](https://support.huaweicloud.com/api-meeting/meeting_21_0109.html#ZH-CN_TOPIC_0212714591__table19371178135314)。 默认值：chinaPR。 maxLength：255 minLength：0                                             |
| deptCode        | 否    | String                                                                | Body   | 部门编码，若不携带则默认根部门。 默认值：1                                                                                                                                                                                                                                                                          |
| desc            | 否    | String                                                                | Body   | 备注。 maxLength：128 minLength：0                                                                                                                                                                                                                         |
| email           | 否    | String                                                                | Body   | 邮箱。 maxLength：255 minLength：0 说明： 统一的邮箱格式，如果企业关闭短信功能，邮箱必填，否则手机、邮箱必填其一。                                                                                               |
| englishName     | 否    | String                                                                | Body   | 企业用户的英文名称。 maxLength：64 minLength：0                                                                                                                                                                                                                      |
| function        | 否    | [UserFunctionDTO] object | Body   | 用户功能位。                                                                                                                                                                                                                                                                                                                                   |
| hidePhone       | 否    | Boolean                                                               | Body   | 是否隐藏手机号码。默认值：false。 - true：在通讯录和会议中不显示手机号码  - false：在通讯录和会议中显示手机号码         |
| name            | 是    | String                                                                | Body   | 企业用户名称。 maxLength：64 minLength：1                                                                                                                                                                                                                        |
| phone           | 否    | String                                                                | Body   | 手机号，必须加上国家码。 例如中国大陆手机为"+86xxxxxxxxxxx"。当填写手机号时 "country"参数必填。 手机号只允许输入纯数字。 说明：手机号或者邮箱至少填写一个。                                                                                                                 |
| pwd             | 否    | String                                                                | Body   | 企业用户账号的密码。若携带则以实际携带为准，否则后台默认生成，密码必须满足： 1、8-32位 2、不能和账号的正序和倒序一致 3、至少包含两种字符类型：小写字母、大写字母、数字、特殊字符（\` \~ ! @ # $ % \^ \& \* ( ) - _ = + \| \[ { } \] ; : " ,' \< . \> / ?）                                        |
| sendNotify      | 否    | String                                                                | Body   | 是否发送开户的邮件和短信通知。 - 0：不发送  - 不填或者其他值就发送，默认发送                                 |
| signature       | 否    | String                                                                | Body   | 签名。 maxLength：512 minLength：0                                                                                                                                                                                                                         |
| sortLevel       | 否    | Integer                                                               | Body   | 通讯录排序等级，序号越低优先级越高。 默认值：10000 maximum：10000 minimum：1                                                                                                                                                          |
| status          | 否    | Integer                                                               | Body   | 用户状态。 - 0：正常  - 1：停用   默认值：0                                                  |
| title           | 否    | String                                                                | Body   | 职位。 maxLength：32 minLength：0                                                                                                                                                                                                                           |
   
 表2UserFunctionDTO 数据结构 
| 参数         | 是否必须 | 类型      | 位置   | 描述                                                                                                              |
|:---|:---|:---|:---|:---|
| enableRoom | 否    | Boolean | Body | 是否开启智能协同白板功能。如果开启，表示该账号是给智能协同白板使用，占用企业智能协同白板的资源，如果资源不足，则无法开启。 默认值：false。 |
   
#### 状态码
表3状态码说明 
| HTTP状态码 | 描述        |
|:---|:---|
| 200     | 操作成功。     |
| 400     | 参数异常。     |
| 401     | 未鉴权或鉴权失败。 |
| 403     | 权限受限。     |
| 500     | 服务端异常     |
   
#### 响应参数
表4响应参数 
| 参数            | 类型                                                                                                                                       | 描述                                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| activeTime    | Long                                                                                                                                     | 激活时间，utc时间戳。                                                                                                                                                                                                                                                                                                                                                                                               |
| adminType     | Integer                                                                                                                                  | 管理员类型。 - 0：默认（超级）管理员  - 1：普通管理员  - 2：非管理员（即为普通企业成员，UserType是2时有效）   |
| corp          | [CorpBasicInfoDTO](https://support.huaweicloud.com/api-meeting/meeting_21_0073.html#ZH-CN_TOPIC_0212714460__table102071496516) object    | 企业注册信息。仅用户查询自己的信息才返回该数据。                                                                                                                                                                                                                                                                                                                                                                                   |
| country       | String                                                                                                                                   | 联系电话所属的国家。                                                                                                                                                                                                                                                                                                                                                                                                 |
| deptCode      | String                                                                                                                                   | 部门编码。                                                                                                                                                                                                                                                                                                                                                                                                      |
| deptName      | String                                                                                                                                   | 部门名称。                                                                                                                                                                                                                                                                                                                                                                                                      |
| deptNamePath  | String                                                                                                                                   | 部门完整名称。                                                                                                                                                                                                                                                                                                                                                                                                    |
| desc          | String                                                                                                                                   | 备注。                                                                                                                                                                                                                                                                                                                                                                                                        |
| devType       | [QueryDeviceInfoResultDTO] object                                                            | 绑定设备类型信息。                                                                                                                                                                                                                                                                                                                                                                                                  |
| email         | String                                                                                                                                   | 邮箱。                                                                                                                                                                                                                                                                                                                                                                                                        |
| englishName   | String                                                                                                                                   | 英文名称。                                                                                                                                                                                                                                                                                                                                                                                                      |
| function      | [UserFunctionDTO] object                                                                    | 用户功能位。                                                                                                                                                                                                                                                                                                                                                                                                     |
| hidePhone     | Boolean                                                                                                                                  | 是否隐藏手机号码。                                                                                                                                                                                                                                                                                                                                                                                                  |
| id            | String                                                                                                                                   | 用户UUID。                                                                                                                                                                                                                                                                                                                                                                                                    |
| license       | Integer                                                                                                                                  | 许可证。 - 0：商用；  - 1：免费试用。                                                                                                                        |
| name          | String                                                                                                                                   | 名称。                                                                                                                                                                                                                                                                                                                                                                                                        |
| phone         | String                                                                                                                                   | 联系电话。                                                                                                                                                                                                                                                                                                                                                                                                      |
| signature     | String                                                                                                                                   | 签名。                                                                                                                                                                                                                                                                                                                                                                                                        |
| sipNum        | String                                                                                                                                   | SIP号码。                                                                                                                                                                                                                                                                                                                                                                                                     |
| sortLevel     | Integer                                                                                                                                  | 通讯录排序等级，序号越低优先级越高。                                                                                                                                                                                                                                                                                                                                                                                         |
| status        | Integer                                                                                                                                  | 用户状态。 - 0：正常；  - 1：停用。                                                                                                                                        |
| thirdAccount  | String                                                                                                                                   | 第三方User ID。                                                                                                                                                                                                                                                                                                                                                                                                |
| title         | String                                                                                                                                   | 职位。                                                                                                                                                                                                                                                                                                                                                                                                        |
| userAccount   | String                                                                                                                                   | 华为云会议账号。                                                                                                                                                                                                                                                                                                                                                                                                   |
| userType      | Integer                                                                                                                                  | 用户类型。 - 2：普通用户  - 13：IdeaHub用户  - 14：SmartRooms用户                 |
| visionAccount | String                                                                                                                                   | 智慧屏唯一账号                                                                                                                                                                                                                                                                                                                                                                                                    |
| vmrList       | Array of [UserVmrDTO](https://support.huaweicloud.com/api-meeting/meeting_21_0073.html#ZH-CN_TOPIC_0212714460__table68128451513) objects | 云会议室列表。                                                                                                                                                                                                                                                                                                                                                                                                    |
   
 表5QueryDeviceInfoResultDTO 数据结构 
| 参数              | 类型     | 描述        |
|:---|:---|:---|
| deviceSize      | String | 设备终端产品尺寸。 |
| model           | String | 终端型号。     |
| purchaseChannel | String | 终端设备购买渠道。 |
   
#### 请求消息示例
```
POST /v1/usg/dcs/corp/member
Connection: keep-alive
Content-Type: application/json
X-Access-Token: stb7PzruAmA6d3JJD578jlAHczGfN4SIaup9
Content-Length: 173
Host: api.meeting.huaweicloud.com
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_191)
{
    "englishName": "englishName",
    "country": "chinaPR",
    "signature": "signature-info",
    "hidePhone": false,
    "sendNotify": "0",
    "title": "manager",
    "sortLevel": 100000,
    "phone": "+86173****9807",
    "function": {
        "enableRoom": true
    },
    "name": "name",
    "pwd": "******",
    "account": "3e48b79b660e403cb5e0208f7be83961",
    "email": "******",
    "deptCode": "1",
    "desc": "desc",
    "status": "status"
}
```
#### 响应消息示例
```
HTTP/1.1 200 
Date: Wed, 18 Dec 2019 06:20:40 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 160
Connection: keep-alive
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: api-gateway
X-Request-Id: ebbb9b1e50d1ec63b78d8484d170173f
{
    "id": "f521bebcbb27422cb3241c4cb19942c5",
    "userAccount": "3e48b79b660e403cb5e0208f7be83961",
    "name": "name",
    "englishName": "englishName",
    "phone": "+86173****9807",
    "country": "chinaPR",
    "email": "******",
    "sipNum": "+8657198480",
    "deptCode": "1",
    "deptName": "根部门",
    "deptNamePath": "根部门",
    "userType": 2,
    "adminType": 2,
    "signature": "signature-info",
    "title": "manager",
    "desc": "desc",
    "corp": null,
    "function": {
        "enableRoom": true
    },
    "devType": {
        "model": null,
        "deviceSize": null,
        "purchaseChannel": null
    },
    "status": 0,
    "sortLevel": 10000,
    "hidePhone": false,
    "visionAccount": null,
    "thirdAccount": "thirdAccount",
    "license": 0,
    "activeTime": 1601221696783,
    "vmrList": [
        {
            "id": "2c908bc76f61a5f2016f61bbfdf5039b",
            "vmrId": "912992631",
            "vmrName": "name的云会议室",
            "vmrPkgId": null,
            "vmrPkgName": null,
            "vmrPkgParties": null,
            "vmrPkgLength": null,
            "status": "0"
        }
    ]
}
```
#### 错误码
当您使用华为云会议服务端API时，如果遇到"MMC"或者"USG"开头的错误码，请参考[华为云API错误中心](https://apierrorcenter.developer.huaweicloud.com/apierrorcenter/errorcode?product=Meeting)。
#### CURL命令示例
```
curl -k -i -H 'content-type: application/json' -X POST -H 'X-Access-Token: stb7PzruAmA6d3JJD578jlAHczGfN4SIaup9' -d '{"account": "test963","country": "chinaPR","deptCode": "1","email": "******","name": "test963","phone": "+86136********","pwd": "******"}' https://api.meeting.huaweicloud.com/v1/usg/dcs/corp/member
```
