
# SP管理员创建企业 - AddCorp
#### 描述
创建企业、默认管理员及分配资源。
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=Meeting&api=AddCorp)中调试该接口。
#### URI
POST /v1/usg/dcs/sp/corp
#### 请求参数
表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。                                                                                                        |
| adminInfo       | 是    | [AdminDTO] object                | Body   | 管理员信息。                                                                                                                           |
| basicInfo       | 是    | [CorpBasicDTO] object            | Body   | 企业的基本信息。                                                                                                                         |
| groupId         | 否    | String                                                                         | Body   | 媒体接入（包括SBC和MCU）分组id，可通过"[SP管理员查询资源信息 - ShowSpResource](https://support.huaweicloud.com/api-meeting/meeting_21_1537.html)"接口查询获取。 |
| propertyInfo    | 否    | Array of [OrgPropertyDTO] objects | Body   | 可配置项信息。                                                                                                                          |
| resInfo         | 否    | [AddCorpResDTO] object          | Body   | 企业的资源信息。                                                                                                                         |
   
 表2AdminDTO 数据结构 
| 参数      | 是否必须 | 类型     | 位置   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|:---|:---|
| account | 是    | String | Body | 用户账号，账号只能包含大小写字母、数字、_、-、.、@符号，不能为纯数字和@后面带.号。                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| country | 否    | String | Body | [手机号所属的国家](https://support.huaweicloud.com/api-meeting/meeting_21_0109.html#ZH-CN_TOPIC_0212714591__table19371178135314)。                                                                                                                                                                                                                                                                                                                                                                             |
| email   | 否    | String | Body | 邮箱，管理员手机和邮箱必填其一，否则无法重置密码。如果企业短信开关关闭，则邮箱必填。格式必须满足(\^$\|\^\[\\w-+\]+(\\.\[\\w-+\]+)*@\[\\w-\]+(\\.\[\\w-\]+)*(\\.\[\\w-\]{1,})$)。                                                                                                                                                                                                                                                                                                                                                                       |
| name    | 是    | String | Body | 名称。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| phone   | 否    | String | Body | 手机号，必须加上国家码，例如中国大陆手机+86xxxxxxx，当填写手机号时"country"参数必填，手机格式必须满足(\^$\|\^\[+\]?\[0-9\]+$)。                                                                                                                                                                                                                                                                                                                                                                                                                 |
| pwd     | 是    | String | Body | 若携带则以前台携带为准，否则后台默认生成，密码必须满足: - 6-32位  - 不能和账号的正序和倒序一致  - 至少包含两种字符类型：小写字母、大写字母、数字、特殊字符(\` \~ ! @ # $ % \^ \& \* ( ) - _ = + \\ \| \[ { } \] ; : " ,' \< . \> / ?   |
   
 表3CorpBasicDTO 数据结构 
| 参数          | 是否必须 | 类型     | 位置   | 描述                                                                                                                        |
|:---|:---|:---|:---|:---|
| address     | 否    | String | Body | 地址。                                                                                                                       |
| country     | 否    | String | Body | [手机号所属的国家](https://support.huaweicloud.com/api-meeting/meeting_21_0109.html#ZH-CN_TOPIC_0212714591__table19371178135314)。 |
| description | 否    | String | Body | 备注。                                                                                                                       |
| domain      | 否    | String | Body | 企业域名。                                                                                                                     |
| email       | 否    | String | Body | 邮箱地址，格式必须满足(\^$\|\^\[\\w-+\]+(.\[\\w-+\]+)*@\[\\w-\]+(.\[\\w-\]+)*(.\[\\w-\]{1,})$)。                                      |
| fax         | 否    | String | Body | 传真号码，格式必须满足(\^$\|\^\[+\]?\[0-9\]+$)。                                                                                      |
| language    | 否    | String | Body | 企业提示音语言设置，zh-CN或en-US。                                                                                                    |
| name        | 是    | String | Body | 企业名称，格式必须满足\^\[\^#%\&'+;\<\>="'??\\....../\]\*$。                                                                          |
| phone       | 否    | String | Body | 手机号，必须加上国家码，例如中国大陆手机+86xxxxxxx，当填写手机号时"country"参数必填，手机格式必须满足(\^$\|\^\[+\]?\[0-9\]+$)。                                     |
| spId        | 否    | String | Body | 企业归属的SP ID。仅在查询时返回。                                                                                                       |
| timeZoneId  | 否    | String | Body | 时区Id设置,例如北京东8区timeZoneId值为56,时区Id和时区的对应关系请参考: [时区表](https://support.huaweicloud.com/api-meeting/meeting_21_0110.html)     |
   
 表4AddCorpResDTO 数据结构 
| 参数       | 是否必须 | 类型                                                                           | 位置   | 描述          |
|:---|:---|:---|:---|:---|
| resource | 否    | Array of [ResourceDTO] objects | Body | 企业待添加的资源列表。 |
   
 表5OrgPropertyDTO 数据结构 
| 参数            | 是否必须 | 类型     | 位置   | 描述                                                                                 |
|:---|:---|:---|:---|:---|
| propertyKey   | 否    | String | Body | 配置项key。 开通本地录制功能，参数填写：enableClientRecord。 |
| propertyValue | 否    | String | Body | 配置项值。 开通本地录制功能，参数填写：true。                  |
   
 表6ResourceDTO 数据结构 
| 参数         | 是否必须 | 类型      | 位置   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|:---|:---|:---|:---|:---|
| id         | 否    | String  | Body | 资源标识，不携带则后台自动生成。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| count      | 是    | Integer | Body | 资源数量。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| expireDate | 是    | Long    | Body | 到期时间，utc时间戳。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| type       | 是    | String  | Body | 资源类型。 - VMR - 云会议室  - CONF_CALL - 会议并发数  - HARD_1080P - 1080P硬终端  - HARD_720P - 720P硬终端  - SOFT - 软终端用户数  - ROOM - 大屏软终端  - LIVE - 直播推流  - RECORD - 录播空间  - HARD_THIRD_PARTY - 第三方硬终端账号  - IDEA_HUB - ideahub               |
| typeId     | 否    | String  | Body | 类型标识，比如资源类型为vmr，vmr又分为5方，10方等，该参数为vmrPkgId，用来区分子类别，详见如下: - vmr10:ff808081699b56d40169c410d5080179  - vmr50:ff808081699b56cb0169c411a0980152  - vmr100:ff808081699b56cb0169c41167850151  - vmr200:ff808081699b56d40169c410913d0178  - vmr25:ff808081699b56d40169c4111fe5017a  - vmr300:ff8080816b9ec3ab016bdff237962e83  - vmr400:ff8080816b9ec475016bdff37efc279f  - vmr500:ff8080816b9ec3ab016bdff338542e84   |
   
#### 状态码
表7状态码说明 
| HTTP状态码 | 描述        |
|:---|:---|
| 200     | 操作成功。     |
| 400     | 参数异常。     |
| 401     | 未鉴权或鉴权失败。 |
| 403     | 权限受限。     |
| 500     | 服务端异常     |
   
#### 响应参数
表8响应参数 
| 参数    | 类型     | 描述    |
|:---|:---|:---|
| value | String | 返回结果。 |
   
#### 请求消息示例
```
POST /v1/usg/dcs/sp/corp
Connection: keep-alive
X-Access-Token: stbVbWSIgzfOQ8JnbmPIoBIR3ig8xnVScQOF
Content-Type: application/json
Content-Length: 561
Host: api.meeting.huaweicloud.com 
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_191)
{
    "adminInfo": {
        "account": "zhangsan@corp",
        "country": "chinaPR",
        "email": "******",
        "name": "zhangsan",
        "phone": "+86191****9092",
        "pwd": "******"
    },
    "basicInfo": {
        "address": "浙江杭州",
        "country": "chinaPR",
        "description": "description",
        "domain": "huawei.com",
        "email": "******",
        "fax": "+123456789",
        "language": "zh-CN",
        "name": "华为技术有限公司",
        "phone": "+86191****9092",
        "spId": "",
        "timeZoneId": "56"
    },
    "groupId": "297e87ec7713734b01771458c2d80000",
    "resInfo": {
        "resource": [
            {
                "count": 10,
                "expireDate": 2549030400000,
                "id": "36f2c0117cf14c3db61a7880eb73cee6",
                "type": "VMR",
                "typeId": "2c90bb2871e577590171e57bfec908b2"
            }
        ]
    }
}
```
#### 响应消息示例
```
HTTP/1.1 200 
Date: Wed, 18 Dec 2019 06:20:40 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 21
Connection: keep-alive
Pragma: No-cache
Cache-Control: no-cache
Server: api-gateway
X-Request-Id: 43689056504b4ff22663262d44e141aa
{
  "value": "818803911"
}
```
#### 错误码
当您使用华为云会议服务端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: stbVbWSIgzfOQ8JnbmPIoBIR3ig8xnVScQOF' -d '{"account": "zhangsan@corp","country": "chinaPR","email": "******","name": "zhangsan","phone": "+86191****9092","pwd": "******","sendNotify": false},"basicInfo": {"address": "浙江杭州","country": "chinaPR","description": "description","domain": "huawei.com","email": "******","fax": "+123456789","language": "zh-CN","name": "华为技术有限公司","phone": "+86191****9092","spId": "","timeZoneId": "56"},"groupId": "297e87ec7713734b01771458c2d80000","resInfo": {"resource": [{"count": 10,"expireDate": 2549030400000,"id": "36f2c0117cf14c3db61a7880eb73cee6","type": "VMR","typeId": "2c90bb2871e577590171e57bfec908b2"}]}}' https://api.meeting.huaweicloud.com/v1/usg/dcs/sp/corp
```
