
# 初始化分传段任务
#### 功能说明
在指定桶中初始化分段上传任务。
#### 方法定义
```
ObsClient.initiateMultipartUpload
```
#### 请求参数
| **字段名**                 | **类型**                                                                      | **约束** | **说明**                                                                                                                                                    |
|:---|:---|:---|:---|
| Bucket                  | String                                                                      | 必选     | 桶名。                                                                                                                                                       |
| Key                     | String                                                                      | 必选     | 对象名。                                                                                                                                                      |
| RequestDate             | String 或 Date | 可选     | 指定请求时间。 说明： 当为String类型时，必须符合ISO8601或RFC822规范。                                                   |
| ACL                     | String                                                                      | 可选     | 创建对象时可指定的[预定义访问策略](https://support.huaweicloud.com/api-obs_browserjs_sdk_api_zh/obs_34_0204.html)。                                                        |
| StorageClass            | String                                                                      | 可选     | 创建对象时可指定的对象的[存储类型](https://support.huaweicloud.com/api-obs_browserjs_sdk_api_zh/obs_34_0205.html)。                                                        |
| Metadata                | Object                                                                      | 可选     | 对象的自定义元数据信息。                                                                                                                                              |
| WebsiteRedirectLocation | String                                                                      | 可选     | 当桶设置了Website配置，该参数指明对象的重定向地址。                                                                                                                             |
| Expires                 | Number                                                                      | 可选     | 对象的生命周期，单位：天。                                                                                                                                             |
| ContentType             | String                                                                      | 可选     | 对象的MIME类型，常见的contentType（MIME）列表参见[配置、编辑、查看对象元数据](https://support.huaweicloud.com/usermanual-obs/obs_03_0324.html)。                                       |
| SseKms                  | String                                                                      | 可选     | 以SSE-KMS方式加密对象，支持的值： - kms        |
| SseKmsKey               | String                                                                      | 可选     | SSE-KMS方式下加密的主密钥ID，可为空。密钥ID获取方法请参见[查看密钥](https://support.huaweicloud.com/usermanual-dew/dew_01_0179.html)。                                                |
| SseC                    | String                                                                      | 可选     | 以SSE-C方式加密对象，支持的值： - AES256   |
| SseCKey                 | String                                                                      | 可选     | SSE-C方式下加密的密钥，该密钥需要您自定义，并由256bit的密钥经过base64编码得到。                                                                                                          |
   
#### 返回结果（InterfaceResult）
| **字段名**   | **类型** | **说明**         |
|:---|:---|:---|
| RequestId | String | OBS服务端返回的请求ID。 |
| Bucket    | String | 分段上传任务的桶名。     |
| Key       | String | 分段上传任务的对象名。    |
| UploadId  | String | 分段上传任务的ID。     |
   
#### 代码样例
```
obsClient.initiateMultipartUpload({
       Bucket:'bucketname',
       Key : 'objectkey',
       ContentType : 'text/plain'
},function (err, result) {
       if(err){
              console.error('Error-->' + err);
       }else{
              if(result.CommonMsg.Status < 300){
                     console.log('RequestId-->' + result.InterfaceResult.RequestId);
                     console.log('Bucket-->' + result.InterfaceResult.Bucket);
                     console.log('Key-->' + result.InterfaceResult.Key);
                     console.log('UploadId-->' + result.InterfaceResult.UploadId);
              }else{
                     console.log('Code-->' + result.CommonMsg.Code);
                     console.log('Message-->' + result.CommonMsg.Message);
              }
       }
});
```
