# Batch query department change records

Batch query department adjustment content based on department adjustment record ID, such as department adjustment type, department name before and after adjustment, role information before and after department adjustment, etc.

**Notice**：- Delay description: The delay of the database leader/follower is within 2s, that is, the user may not be able to query the data by calling this interface within 2s after receiving the process state change message.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/corehr/v2/approval_groups/open_query_department_change_list_by_ids
HTTP Method | POST
Rate Limit | [5 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App、Store App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.** | 获取组织架构调整部门调整内容(corehr:approval_groups.orgdraft_department_change:read)
Required field scopes | **Notice**：The response body of the API contains the following sensitive fields, and they will be returned only after corresponding scopes are added. If you do not need the fields, it is not recommended that you request the scopes.<br>Obtain user ID(contact:user.employee_id:readonly)<br>获取组织角色(corehr:orgrole_info:read)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer t-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
process_id | string | Yes | Organizational structure adjustment process ID. When a user initiates an organizational structure adjustment through "Feishu HR-My Team-Organizational Structure" or "Feishu HR-Personnel Management-Organizational Structure" and submits it for approval, the system will generate one or more approval documents based on the rules configured by the administrator in the approval process.<br>**Example value**: 6893014062142064211
user_id_type | string | No | User ID categories<br>**Example value**: open_id<br>**Optional values are**:<br>- open_id：Identifies a user to an app. The same user has different Open IDs in different apps. [How to get Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid)<br>- union_id：Identifies a user to a tenant that acts as a developer. A user has the same Union ID in apps developed by the same developer, and has different Union IDs in apps developed by different developers. A developer can use Union ID to link the same user's identities in multiple apps.[How to get Union ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id)<br>- user_id：Identifies a user to a tenant. The same user has different User IDs in different tenants. In one single tenant, a user has the same User ID in all apps （including store apps）. User ID is usually used to communicate user data between different apps. [How to get User ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id)<br><md-enum-item key="people_corehr_id" ><br>**Default value**: `open_id`<br>**When the value is `user_id`, the following field scopes are required**:<br>Obtain user ID(contact:user.employee_id:readonly)
department_id_type | string | No | The type of department ID used in this call<br>**Example value**: open_department_id<br>**Optional values are**:<br>- open_department_id：Identify departments by open_department_id<br>- department_id：Identify departments by department_id<br>- people_corehr_department_id：Identify departments by people_corehr_department_id<br>**Default value**: `open_department_id`

### Request body

Parameter | Type | Required | Description
---|---|---|---
department_change_ids | string\[\] | No | Department adjustment record ID list. The adjustment record details can be obtained through [[Query organizational structure adjustment records based on process ID]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/approval_groups/get).<br>- Must be the department adjustment record ID under the process corresponding to the query parameter process_id.<br>- If not set, the queried department adjustment record is empty.<br>- The returned change ID type is consistent with the ```department_id_type``` in the query parameter. <br>**Example value**: ["6893014062142064111"]<br>**Data validation rules**:<br>- Length range: `1` ～ `100`
need_department_path | boolean | No | Whether to return the full path of the department. This is used in the scenario of cascading department creation during organizational structure adjustment. Since the parent department has not yet taken effect, the full path is returned for data query.<br>**Example value**: true<br>**Default value**: `false`

### Request body example
```json
{
    "department_change_ids": [
        "6893014062142064111"
    ],
    "need_department_path": true
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
department_changes | department_change\[\] | Department adjustment record information list
department_change_id | string | Department Adjustment Record ID
department_id | string | Department ID, for departments newly created in this adjustment, will be returned as empty when the adjustment does not take effect. Supports conversion according to department ID type
draft_department_id | string | Adjust the process department ID. Fixed return people_corehr_department_id, no conversion based on department ID type. For new departments created in this adjustment, the process department ID in the format of td_xxx will be returned before the adjustment takes effect, and the official people_corehr_department_id will be returned after it takes effect(The data has been written successfully, but it is not in an effective departmental status).
department_change_type | string | Adjust type<br>**Optional values are**:<br>- Unknown：unknown<br>- Create：new build<br>- Modify：edit<br>- Inactive：deactivate
department_change_status | int | Adjustment status<br>**Optional values are**:<br>- 0：Initiate approval, the process is successfully initiated and waits for approval by the approver.<br>- 1：Approval approved.<br>- 2：Approval was rejected and approval was not passed.<br>- 3：The approval is revoked. If the user actively revokes the approval, the adjustment will enter the revoked state.<br>- 4：Execution successful, the adjustment has been executed successfully.<br>- 5：Execution failed. Adjustment has failed.<br>- 6：To be executed, the adjustment depends on other processes to be completed and is waiting for execution. This will only be triggered if you are a byte tenant or a commercial tenant and configure the split approval flow (combined order). The execution of the approval order where the adjustment is made depends on the execution result of another approval order that is initiated at the same time and is still in the approval state.
reorganization_info | reorganization_info | Adjust the details
original_department_names | i18n\[\] | Original department name
lang | string | language
value | string | content
target_department_names | i18n\[\] | Department name after adjustment
lang | string | language
value | string | content
original_department_code | string | Original department code
target_department_code | string | After the adjustment, in the scenario of creating a new department, if the tenant enables automatic department coding, the code will be empty.
original_sub_type | enum | The original department type, the enumeration value can be passed through the document [[Feishu Personnel Enumeration Constant]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant) department subtype (department_sub_type) The enumeration definition part is obtained
enum_name | string | enumeration value
display | i18n\[\] | Enumerate multilingual display
lang | string | language
value | string | content
target_sub_type | enum | After adjusting the department type, the enumeration value can be determined through the document [[Feishu Personnel Enumeration Constant]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant) department subtype (department_sub_type ) obtained from the enumeration definition part
enum_name | string | enumeration value
display | i18n\[\] | Enumerate multilingual display
lang | string | language
value | string | content
original_department_manager | string | Former department manager. Detailed information can be obtained through the [[Search employee information]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/employee/search) interface
target_department_manager | string | The manager of the department after the adjustment, detailed information can be obtained through the [[Search employee information]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/employee/search) interface
original_descriptions | i18n\[\] | Original description
lang | string | language
value | string | content
target_descriptions | i18n\[\] | Adjusted description
lang | string | language
value | string | content
original_cost_center | cost_center | Original default cost center
cost_center_id | string | Cost center ID, you can get the corresponding cost center information through the [Search cost center information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/cost_center/search) interface
cost_center_version_id | string | Cost center Version ID
name | i18n\[\] | Cost center name
lang | string | language
value | string | content
code | string | code
parent_cost_center_id | string | The superior cost center ID can be obtained through the [Search cost center information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/cost_center/search) interface
managers | string\[\] | The ID list of the person in charge of the cost center, the detailed information can be obtained through the [Search employee information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/employee/search) interface
description | i18n\[\] | Cost center description
lang | string | language
value | string | content
effective_time | string | Effective time<br>- Date format: YYYY-MM-DD<br>- Minimum value: 1900-01-01<br>- Maximum value: 9999-12-31
expiration_time | string | Expiration date<br>- Date format: YYYY-MM-DD<br>- Minimum value: 1900-01-01<br>- Maximum value: 9999-12-31
active | boolean | Whether the current entity is enabled
operation_reason | string | Reason for operation
target_cost_center | cost_center | Default cost center after adjustment
cost_center_id | string | Cost center ID, you can get the corresponding cost center information through the [Search cost center information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/cost_center/search) interface
cost_center_version_id | string | Cost center Version ID
name | i18n\[\] | Cost center name
lang | string | language
value | string | content
code | string | coding
parent_cost_center_id | string | The superior cost center ID can be obtained through the [Search cost center information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/cost_center/search) interface
managers | string\[\] | The ID list of the person in charge of the cost center, the detailed information can be obtained through the [Search employee information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/employee/search) interface
description | i18n\[\] | Cost center description
lang | string | language
value | string | content
effective_time | string | Effective time<br>- Date format: YYYY-MM-DD<br>- Minimum value: 1900-01-01<br>- Maximum value: 9999-12-31
expiration_time | string | Expiration date<br>- Date format: YYYY-MM-DD<br>- Minimum value: 1900-01-01<br>- Maximum value: 9999-12-31
active | boolean | Whether the current entity is enabled
operation_reason | string | Reason for operation
original_is_confidential | boolean | Whether the original confidentiality
target_is_confidential | boolean | Whether to keep it confidential after adjustment
original_staffing_mode_option | enum | Original staffing model<br>- obtained by [Get Field Details](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/get_by_param)query. Request parameters: object_api_name = department; custom_api_name = staffing_model.
enum_name | string | enumeration value
display | i18n\[\] | Enumerate multilingual display
lang | string | language
value | string | content
target_staffing_mode_option | enum | Target staffing model<br>- obtained by [Get Field Details](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/get_by_param) query. Request parameters: object_api_name = department; custom_api_name = staffing_model.
enum_name | string | enumeration value
display | i18n\[\] | Enumerate multilingual display
lang | string | language
value | string | content
original_parent_department_id | string | The original superior department ID supports conversion based on department ID type.
target_parent_department_id | string | The adjusted parent department ID, for the newly created departments in this adjustment, will be returned to empty when the adjustment does not take effect. Supports type conversion based on department ID.
draft_target_parent_department_id | string | Adjusted higher department process ID. Fixed return people_corehr_department_id and will not be converted according to department ID type. For departments newly created in this adjustment, the process department ID in the format of td_xxx will be returned before the adjustment takes effect, and the official people_corehr_department_id will be returned when it takes effect
original_department_id_path | orgdraft_department_id\[\] | The full path of the original department, starting from the root department and returning the department ID list from top to bottom
department_id | string | Department ID, for departments created in this adjustment, will be returned as empty when the adjustment does not take effect. Supports conversion based on department ID type.
draft_department_id | string | Adjust the process department ID, fixed return people_corehr_department_id, will not be converted according to the department ID type. For the newly created department in this adjustment, the process department ID in the format of td_xxx will be returned before the adjustment takes effect, and the official people_corehr_department_id will be returned after it takes effect
target_department_id_path | orgdraft_department_id\[\] | The full path of the target department, starting from the root department and returning the department ID list from top to bottom
department_id | string | Department ID, for departments created in this adjustment, will be returned as empty when the adjustment does not take effect. Supports conversion based on department ID type.
draft_department_id | string | Adjust the process department ID, fixed return people_corehr_department_id, will not be converted according to the department ID type. For the newly created department in this adjustment, the process department ID in the format of td_xxx will be returned before the adjustment takes effect, and the official people_corehr_department_id will be returned after it takes effect
custom_fields | change_field_pair\[\] | Custom fields
origin_value | custom_field_data | before fixing
custom_api_name | string | Custom field apiname, the unique identifier of the custom field
name | custom_name | Custom field name
zh_cn | string | Chinese
en_us | string | English
type | int | Custom field types, see [Get custom field list](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/query)
value | string | The field value is the string escaped by json. According to the metadata definition, the field format is different. For example ：```("\" 123 \"", "\" 123.23 \"", "\" true \"", [\" id1\ ",\" id2 \"], \" 2006-01-02 15:04:05\ ")```
target_value | custom_field_data | adjusted
custom_api_name | string | Custom field apiname, the unique identifier of the custom field
name | custom_name | Custom field name
zh_cn | string | Chinese
en_us | string | English
type | int | Custom field types, see [Get custom field list](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/query)
value | string | The field value is the string escaped by json. According to the metadata definition, the field format is different. For example ：```("\" 123 \"", "\" 123.23 \"", "\" true \"", [\" id1\ ",\" id2 \"], \" 2006-01-02 15:04:05\ ")```
orgrole_infos | orgrole_info\[\] | Organizational role information before and after adjustment<br>**Required field scopes**:<br>获取组织角色(corehr:orgrole_info:read)
role_id | string | Role ID<br>- Get other role information through [[Batch Get Role List]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/security_group/list)
origin_orgroles | orgdraft_orgrole_assignment\[\] | Original organizational role
grantee_id | string | Authorized user id<br>- Get other employee information through [[Batch obtain employee information]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/directory-v1/employee/mget).
management_scopes | orgrole_assignment.org\[\] | Management scope, value when organizational roles are cross-cutting.
org_id | string | Organization ID<br>- When org_type is location, you can use [[Batch get location information by location ID]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/location/batch_get) to get other location information.
org_type | string | Organization type<br>**Optional values are**:<br>- department：department<br>- location：location<br>- custom_org_01：custom organization<br>- custom_org_02：custom organization<br>- custom_org_03：custom organization<br>- custom_org_04：custom organization<br>- custom_org_05：custom organization
org_name | string | organization name
target_orgroles | orgdraft_orgrole_assignment\[\] | New organizational roles
grantee_id | string | Authorized user id<br>- Get other employee information through [[Batch obtain employee information]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/directory-v1/employee/mget).
management_scopes | orgrole_assignment.org\[\] | Management scope, value when organizational roles are cross-cutting.
org_id | string | Organization ID<br>- When org_type is location, you can use [[Batch get location information by location ID]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/location/batch_get) to get other location information.
org_type | string | Organization type<br>**Optional values are**:<br>- department：department<br>- location：location<br>- custom_org_01：custom organization<br>- custom_org_02：custom organization<br>- custom_org_03：custom organization<br>- custom_org_04：custom organization<br>- custom_org_05：custom organization
org_name | string | organization name

### Response body example
```json
{
	"code": 0,
	"msg": "Success",
	"data": {
		"department_changes": [{
			"department_change_id": "6991776076699549697",
			"department_id": "6966236933198579208",
			"draft_department_id": "6966236933198579208",
			"department_change_type": "Modify",
			"reorganization_info": {
				"original_department_names": [{
					"lang": "zh-CN",
					"value": "Technology R&D Department"
				}],
				"target_department_names": [{
					"lang": "zh-CN",
					"value": "Product Technology Center"
				}],
				"original_department_code": "D00000456",
				"target_department_code": "D00000456",
				"original_sub_type": {
					"enum_name": "division",
					"display": [{
						"lang": "zh-CN",
						"value": "division"
					}]
				},
				"target_sub_type": {
					"enum_name": "department",
					"display": [{
						"lang": "zh-CN",
						"value": "department"
					}]
				},
				"original_department_manager": "6974648866876573198",
				"target_department_manager": "7013328578351842852",
				"original_descriptions": [{
					"lang": "zh-CN",
					"value": "Responsible for the technical development and maintenance of the company's core systems, focusing on backend architecture construction and performance optimization
"
				}],
				"target_descriptions": [{
					"lang": "zh-CN",
					"value": "Coordinate product design and technology research and development, covering the entire process from demand analysis to system implementation, and promote the integrated development of product technology"
				}],
				"original_cost_center": {
					"cost_center_id": "6969828847121885087",
					"name": [{
						"lang": "zh-CN",
						"value": "R&D Cost Center - 001"
					}]
				},
				"target_cost_center": {
					"cost_center_id": "6969828847121885087",
					"name": [{
						"lang": "zh-CN",
						"value": "Product Technology Cost Center - 002"
					}]
				},
				"original_is_confidential": true,
				"target_is_confidential": true,
				"original_parent_department_id": "6974659700705068581",
				"target_parent_department_id": "6974659700705068581",
				"draft_target_parent_department_id": "6966236933198579208",
				"original_department_id_path": [{
					"department_id": "6974659700705068581",
					"draft_department_id": "6974659700705068581"
				}],
				"target_department_id_path": [{
					"department_id": "6974659700705068581",
					"draft_department_id": "6974659700705068581"
				}],
				"custom_fields": [{
					"origin_value": {
						"custom_api_name": "name",
						"name": {
							"zh_cn": "custom name",
							"en_us": "Custom Name"
						},
						"type": 1,
						"value": "\"231\""
					},
					"target_value": {
						"custom_api_name": "name",
						"name": {
							"zh_cn": "custom name",
							"en_us": "Custom Name"
						},
						"type": 1,
						"value": "\"231\""
					}
				}]
			}
		}]
	}
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
200 | 1162001 | Approval process not found | Please check whether the approval flow ID is correct
200 | 1161000 | Adjustment draft not found | Please check whether the department adjustment record ID is correct

