
# 导入collection文件生成测试步骤 - CreateTestStepByCollection
#### 功能介绍
上传postman的collection文件
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-testman/cloudtest_03_2000.html)。
#### URI
POST /v1/{project_id}/postman-collection
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| project_id | 是    | String | **参数解释**: 项目UUID，项目唯一标识，固定长度32位字符（字母和数字）。获取方式请参见[获取项目ID](https://support.huaweicloud.com/api-testman/cloudtest_03_4003.html) **约束限制**: 不涉及 **取值范围**: 项目uuid应符合如下规则：长度等于32位字符，包含大小写字母、数字 **默认取值**: 不涉及 |
   
表2Query参数 
| 参数            | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|:---|
| branch_uri    | 否    | String | 分支唯一标识                                                                                                                                                                                                                                                                                                                                                                                                 |
| tmss_case_uri | 否    | String | **参数解释** 测试管理用例uri **约束限制** 不涉及 **取值范围** 不超过32个字符组成的字符串 **默认取值** 不涉及 |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释：** 用户Token。 通过调用IAM服务[获取用户Token](https://support.huaweicloud.com/api-iam/iam_30_0001.html)接口获取（响应消息头中X-Subject-Token的值）。 **约束限制：** 必传。 **取值范围：** 字符串长度不少于1，不超过10万。 **默认取值：** 不涉及。 |
   
表4FormData参数 
| 参数  | 是否必选 | 参数类型 | 描述      |
|:---|:---|:---|:---|
| req | 是    | File | 要上传的文件流 |
   
#### 响应参数
**状态码：200**
表5响应Body参数 
| 参数     | 参数类型                                                                                                    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|
| error  | [CommonResponseErrorOfobject] object | **参数解释** 统一错误返回 **取值范围** 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                  |
| reason | String                                                                                                  | **参数解释** 接口调用失败原因 **取值范围** 不超过1000个字符组成的字符串                                                                                                                                                                                                                                                                                                                                                                                                   |
| result | Object                                                                                                  | **参数解释** 结果 **取值范围** 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                      |
| status | String                                                                                                  | **参数解释** '状态值，如success、error' **取值范围** - success，请求成功   - error，请求报错    |
   
 表6CommonResponseErrorOfobject 
| 参数     | 参数类型   | 描述                                                                                                                                                                                    |
|:---|:---|:---|
| code   | String | **参数解释** 接口调用失败错误码 **取值范围** 不超过256个字符组成的字符串 |
| reason | String | **参数解释** 接口调用失败原因 **取值范围** 不超过1000个字符组成的字符串 |
   
**状态码：401**
表7响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                     |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 12-18个字符组成的字符串   |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 3-1000个字符组成的字符串 |
   
**状态码：403**
表8响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                     |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 12-18个字符组成的字符串   |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 3-1000个字符组成的字符串 |
   
**状态码：404**
表9响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                     |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 12-18个字符组成的字符串   |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 3-1000个字符组成的字符串 |
   
**状态码：500**
表10响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                     |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 12-18个字符组成的字符串   |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 3-1000个字符组成的字符串 |
   
#### 请求示例
```
post https://{endpoint}/v1/5a20b8323f3548008bd6e5669567538f/postman-collection?branch_uri=v91j0000vljf6i3s&tmss_case_uri=v91k0000vm823f04
```
#### 响应示例
**状态码：200**
SUCCESS
```
{
  "status" : "success",
  "result" : [ {
    "id" : "1780286802764e67bcb581f498ff21f0",
    "projectId" : "925bb3aa54e145569f39e1d1b0fac371",
    "changeSign" : 0,
    "region" : "{region}",
    "relation" : null,
    "children" : null,
    "scriptName" : "https://100.93.1.72:8443/goserver/reflect\n",
    "create_time_string" : "2025-06-16 19:17:38 GMT+08:00",
    "update_time_string" : "2025-06-16 19:17:38 GMT+08:00",
    "create_time_stamp" : 1750072658000,
    "update_time_stamp" : 1750072658000,
    "create_user" : "CloudTest-0704",
    "create_time" : "2025-06-16T07:17:38+0800",
    "update_user" : "CloudTest-0704",
    "update_time" : "2025-06-16T07:17:38+0800",
    "name" : "https://100.93.1.72:8443/goserver/reflect\n",
    "condition_type" : null,
    "condition_statement" : null,
    "body_param_type" : "text",
    "aw_type" : 1,
    "aw_id" : "",
    "basic_aw" : {
      "id" : "",
      "warningMsg" : null,
      "name" : "https://100.93.1.72:8443/goserver/reflect\n",
      "source" : null,
      "method" : "https://100.93.1.72:8443/goserver/reflect\n",
      "description" : "https://100.93.1.72:8443/goserver/reflect\n",
      "nameView" : null,
      "tmssCaseNumber" : null,
      "region" : null,
      "yamlName" : null,
      "create_time_string" : "2025-06-16 19:17:38 GMT+08:00",
      "update_time_string" : "2025-06-16 19:17:38 GMT+08:00",
      "create_time_stamp" : 1750072658000,
      "update_time_stamp" : 1750072658000,
      "create_user" : "CloudTest-0704",
      "create_time" : "2025-06-16T07:17:38+0800",
      "update_user" : "CloudTest-0704",
      "update_time" : "2025-06-16T07:17:38+0800",
      "param_type_and_dft_value" : [ {
        "type" : "String",
        "name" : "body",
        "required" : false,
        "disabled" : false,
        "description" : null,
        "mock" : null,
        "isChecked" : null,
        "is_big_field" : null,
        "value_type" : 0,
        "basic_value" : {
          "value" : "{\r\n    \"result\": {\r\n        \"code\": 200,\r\n        \"status\": \"success\",\r\n        \"message\": [\r\n            {\r\n                \"key1\": \"value1\"\r\n            },\r\n            {\r\n                \"key2\": \"value2\"\r\n            },\r\n            {\r\n                \"key3\": \"value3\"\r\n            },\r\n            {\r\n                \"key4\": \"value4\"\r\n            },\r\n            {\r\n                \"key5\": \"value5\"\r\n            }\r\n        ]\r\n    }\r\n}",
          "value_range" : null
        },
        "enum_type" : null,
        "enum_type_selected" : null,
        "minLength" : null,
        "maxLength" : null,
        "minimum" : null,
        "maximum" : null,
        "format" : null,
        "pattern" : null,
        "xChoiceValue" : null,
        "maxItems" : null,
        "minItems" : null,
        "validate_rule" : null,
        "defaultValue" : null,
        "drop_down_value" : null,
        "in_type" : 2,
        "is_body_custom" : null,
        "custom_body" : null,
        "basic_value_list" : null,
        "object_value" : null,
        "object_value_list" : null,
        "is_contract_param" : null,
        "item" : null,
        "is_sensitive" : null
      } ],
      "dft_custom_header" : null,
      "dft_check_point_list" : null,
      "dft_variable_list" : null,
      "keyword_variable_value" : null,
      "dft_retry_times" : null,
      "dft_retry_interval" : null,
      "return_type" : null,
      "aw_type" : 1,
      "aw_ins_list" : null,
      "project_id" : "925bb3aa54e145569f39e1d1b0fac371",
      "public_aw_lib_id" : null,
      "special_type" : 99,
      "has_code" : null,
      "aw_code" : null,
      "group_name" : null,
      "protocol_type" : "http/https",
      "by_order" : null,
      "aw_mark" : 1,
      "output_param_list" : null,
      "is_favorite" : null,
      "tmss_case_id" : null,
      "create_user_id" : "fdc93bccd8d040778701d4d35a4a4313",
      "aw_description" : null,
      "origin_project" : null,
      "aw_uniqueid" : null,
      "aw_tags" : null,
      "aw_operationid" : null,
      "interface_label" : null,
      "import_package" : null,
      "public_aw_lib" : null,
      "root_id" : null,
      "custom_aw_libs" : null,
      "delete_time" : null,
      "delete_user" : null,
      "extra_info" : {
        "http_url" : "https://100.93.1.72:8443/goserver/reflect",
        "http_method" : "POST"
      }
    },
    "param_type_and_value" : [ {
      "type" : "String",
      "name" : "body",
      "required" : false,
      "disabled" : false,
      "description" : null,
      "mock" : null,
      "isChecked" : null,
      "is_big_field" : null,
      "value_type" : 0,
      "basic_value" : {
        "value" : "{\r\n    \"result\": {\r\n        \"code\": 200,\r\n        \"status\": \"success\",\r\n        \"message\": [\r\n            {\r\n                \"key1\": \"value1\"\r\n            },\r\n            {\r\n                \"key2\": \"value2\"\r\n            },\r\n            {\r\n                \"key3\": \"value3\"\r\n            },\r\n            {\r\n                \"key4\": \"value4\"\r\n            },\r\n            {\r\n                \"key5\": \"value5\"\r\n            }\r\n        ]\r\n    }\r\n}",
        "value_range" : null
      },
      "enum_type" : null,
      "enum_type_selected" : null,
      "minLength" : null,
      "maxLength" : null,
      "minimum" : null,
      "maximum" : null,
      "format" : null,
      "pattern" : null,
      "xChoiceValue" : null,
      "maxItems" : null,
      "minItems" : null,
      "validate_rule" : null,
      "defaultValue" : null,
      "drop_down_value" : null,
      "in_type" : 2,
      "is_body_custom" : null,
      "custom_body" : null,
      "basic_value_list" : null,
      "object_value" : null,
      "object_value_list" : null,
      "is_contract_param" : null,
      "item" : null,
      "is_sensitive" : null
    } ],
    "check_point_list" : [ ],
    "variable_list" : [ ],
    "retry_times" : "0",
    "retry_interval" : "0",
    "by_order" : 0,
    "from_outside" : null,
    "service_and_stage" : null,
    "is_contract_aw" : null,
    "is_sectest_aw" : null,
    "is_disabled" : null,
    "param_dependent" : null,
    "param_dependent_enabled" : null,
    "relation_id" : null,
    "relation_type" : 0,
    "extra_info" : {
      "summary" : null,
      "outputParam" : null,
      "importPackage" : null,
      "childImportPackage" : null,
      "mock" : null,
      "http_method" : "POST",
      "http_url" : "https://100.93.1.72:8443/goserver/reflect",
      "document_link" : null,
      "param_dependent" : null
    },
    "custom_header" : [ ],
    "level" : null,
    "hasLevel" : null,
    "is_basic" : 0,
    "his_script" : null,
    "description" : "https://100.93.1.72:8443/goserver/reflect\n",
    "aw_description" : null,
    "user_id" : null,
    "special_type" : 0,
    "error_info" : null,
    "alias_runaw" : null,
    "authentication_type" : null,
    "authentication_info" : null,
    "testmate_type" : null,
    "output_alias_info" : null,
    "header_array" : null
  } ],
  "reason" : null,
  "error" : null
}
```
#### 状态码
| 状态码 | 描述           |
|:---|:---|
| 200 | SUCCESS      |
| 401 | Unauthorized |
| 403 | Forbidden    |
| 404 | Not Found    |
| 500 | ERROR        |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-testman/ErrorCode.html)。
