
# 查询2个项目间扩展字段的差异 - QueryProjectDiffCustomField
#### 功能介绍
此接口用于查询2个项目间扩展字段的差异
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-testman/cloudtest_03_2000.html)。
#### URI
GET /v4/project/source/{source_project_uuid}/target/{project_uuid}/diff/custom-field
表1路径参数 
| 参数                  | 是否必选 | 参数类型   | 描述                                                             |
|:---|:---|:---|:---|
| source_project_uuid | 是    | String | **参数解释** 源项目ID  |
| project_uuid        | 是    | String | **参数解释** 目标项目ID |
   
#### 请求参数
无
#### 响应参数
**状态码：200**
表2响应Body参数 
| 参数        | 参数类型                                                                                               | 描述         |
|:---|:---|:---|
| total     | Integer                                                                                            | 符合条件的所有记录数 |
| value     | [ProjectCustomFieldDiffVo] object | 扩展字段差异     |
| reason    | String                                                                                             | 错误信息       |
| page_size | Integer                                                                                            | 每页展示条数     |
| page_no   | Integer                                                                                            | 页码         |
| has_more  | Boolean                                                                                            | 是否有更多      |
   
 表3ProjectCustomFieldDiffVo 
| 参数           | 参数类型                                                                                                       | 描述                      |
|:---|:---|:---|
| source_mores | Array of [SimpleCaseFieldVo] objects             | 源项目比目标项目多的属性字段集合        |
| target_mores | Array of [SimpleCaseFieldVo] objects             | 目标项目比源项目多的属性字段集合        |
| diffs        | Array of [SingleCustomFieldDiffVo] objects | 源和目标项目字段名相同但字段类型或字段选项不同 |
| both_haves   | Array of [SimpleCaseFieldVo] objects             | 源和目标项目都有的字段             |
   
 表4SingleCustomFieldDiffVo 
| 参数             | 参数类型             | 描述       |
|:---|:---|:---|
| name           | String           | 字段显示名称   |
| source_type    | String           | 源项目字段类型  |
| target_type    | String           | 目标项目字段类型 |
| source_options | Array of strings | 源项目字段选项  |
| target_options | Array of strings | 目标项目字段选项 |
   
 表5SimpleCaseFieldVo 
| 参数   | 参数类型   | 描述     |
|:---|:---|:---|
| uri  | String | 字段唯一标识 |
| name | String | 字段显示名称 |
| type | String | 字段类型   |
   
**状态码：400**
表6响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                            |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 不涉及  |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 不涉及 |
   
**状态码：500**
表7响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                            |
|:---|:---|:---|
| error_code | String | **参数解释** 接口调用失败错误码 **取值范围** 不涉及  |
| error_msg  | String | **参数解释** 接口调用失败错误信息 **取值范围** 不涉及 |
   
#### 请求示例
查询2个项目间扩展字段的差异
```
GET https://{endpoint}/v4/project/source/{source_project_uuid}/target/{project_uuid}/diff/custom-field
{
  "source_project_uuid" : "source-proj-uuid-001",
  "project_uuid" : "098ad17656684cc5a49a4f7007517f95"
}
```
#### 响应示例
**状态码：200**
OK
```
{
  "total" : 1,
  "value" : {
    "source_mores" : [ {
      "uri" : "field-001",
      "name" : "优先级",
      "type" : "enum"
    } ],
    "target_mores" : [ {
      "uri" : "field-001",
      "name" : "Priority",
      "type" : "enum"
    } ],
    "diffs" : [ ]
  },
  "reason" : "",
  "page_size" : 20,
  "page_no" : 1,
  "has_more" : false
}
```
**状态码：400**
Bad Request
```
{
  "error_code" : "CLOUDTEST.00000001",
  "error_msg" : "返回的错误信息"
}
```
**状态码：500**
Internal Server Error
```
{
  "error_code" : "CLOUDTEST.00000001",
  "error_msg" : "返回的错误信息"
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 400 | Bad Request           |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-testman/ErrorCode.html)。
