# Batch get employee job data

Batch get job data through employee employment ID.
**Notice**：The interface will return data according to the permission scope of "employee resources" owned by the application. Please make sure that the permission scope of "employee resources" has been applied in "Developer Background - Rights Management - Data Rights".

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/corehr/v2/employees/job_datas/batch_get
HTTP Method | POST
Rate Limit | [100 per minute](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.**<br>Enable any scope from the list | View employee's job information(corehr:employee.job_data:read)<br>View job information(corehr:job_data:read)<br>Read and write job information(corehr:job_data:write)
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>Get employee's job information(corehr:employment.job:read)<br>Get employee's job level(corehr:employment.job_level:read)<br>Read employee's position information(corehr:employment.position:read)<br>Read and write employee's position information(corehr:employment.position:write)<br>Obtain user ID(contact:user.employee_id:readonly)<br>Read and write employee's job level information(corehr:employment.job_level:write)<br>Get job grade information(corehr:employment.job_grade:read)<br>Read and write job grade information(corehr:employment.job_grade:write)<br>Get work shift information(corehr:job_data.work_shift:read)<br>Get salary type(corehr:job_data.compensation_type:read)<br>读取任职原因(corehr:job_data.job_data_reason:read)<br>Get company of employment(corehr:job_data.service_company:read)<br>View reason field in employment history(corehr:job_data.assignment_start_reason: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
---|---|---|---
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 department ID type used in this call<br>**Example value**: people_corehr_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**: `people_corehr_department_id`

### Request body

Parameter | Type | Required | Description
---|---|---|---
employment_ids | string\[\] | Yes | Employee Employment ID List<br>**Example value**: ["7140964208476371111"]<br>**Data validation rules**:<br>- Length range: `1` ～ `100`
get_all_version | boolean | No | Whether to get all job datas, true is to get all versions of job datas of employees, false is to get only the currently valid job datas, the default is false<br>**Example value**: false
effective_date_start | string | No | Effective Date - Search Range Begins<br>**Example value**: "2020-01-01"
effective_date_end | string | No | Effective Date - End of Search Range<br>**Example value**: "2020-01-01"
data_date | string | No | View data date, default is today<br>**Example value**: "2020-01-01"
primary_job_data | boolean | No | Whether to inquire only about the main position<br>- true: returns only employment records primary_job_data true<br>- false: returns only job records primary_job_data false<br>- Do not pass: return to all<br>**Example value**: true
assignment_start_reasons | string\[\] | No | Business type (original: reason for employment)<br>- You can query through the [[Get Field Details]] (/ssl: ttdoc/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/get_by_param) interface, the query parameters are as follows:<br>- object_api_name: job_data<br>- custom_api_name: assignment_start_reason<br>**Example value**: ["onboarding"]<br>**Default value**: `[]`

### Request body example
```json
{
    "employment_ids": [
        "7140964208476371111"
    ],
    "get_all_version": false,
    "effective_date_start": "2020-01-01",
    "effective_date_end": "2020-01-01",
    "data_date": "2020-01-01",
    "primary_job_data": true,
    "assignment_start_reasons": [
        "onboarding"
    ]
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
items | employee_job_data\[\] | Inquired employment information
employment_id | string | Employment ID
job_datas | job_data\[\] | The unique key of the entity inside CoreHR
job_data_id | string | Job data ID
version_id | string | Job data version ID
employee_type_id | string | Employee type ID, enumeration value and detailed information can be obtained through the [Query an individual employee type](https://open.feishu.cn/document/server-docs/corehr-v1/basic-infomation/employee_type/get) interface query
working_hours_type_id | string | Working hours type ID, enumeration value and detailed information can be obtained through the [Query individual working hours type](https://open.feishu.cn/document/server-docs/corehr-v1/basic-infomation/working_hours_type/get) interface query
work_location_id | string | Work location ID, enumeration value and detailed information can be obtained through the [Get location information](https://open.feishu.cn/document/server-docs/corehr-v1/organization-management/location/get) interface query
department_id | string | Department ID, enumeration value and detailed information can be obtained through the [Get department information](https://open.feishu.cn/document/server-docs/corehr-v1/organization-management/department/get) interface query
position_id | string | Positon ID, enumeration value and detailed information can be obtained through the [Query Single Job] interface query<br>**Required field scopes (Satisfy any)**:<br>Read employee's position information(corehr:employment.position:read)<br>Read and write employee's position information(corehr:employment.position:write)
job_id | string | Job ID, enumeration value and detailed information can be obtained through the [Get job profile](https://open.feishu.cn/document/server-docs/corehr-v1/job-management/job/get) interface query<br>**Required field scopes (Satisfy any)**:<br>Get employee's job information(corehr:employment.job:read)<br>Get employee's job level(corehr:employment.job_level:read)<br>Read and write employee's job level information(corehr:employment.job_level:write)
job_level_id | string | The job level ID, enumeration value and detailed information can be obtained through the [Get job level](https://open.feishu.cn/document/server-docs/corehr-v1/job-management/job_level/get) interface query<br>**Required field scopes (Satisfy any)**:<br>Get employee's job level(corehr:employment.job_level:read)<br>Read and write employee's job level information(corehr:employment.job_level:write)
job_grade_id | string | Grade ID<br>**Required field scopes (Satisfy any)**:<br>Get job grade information(corehr:employment.job_grade:read)<br>Read and write job grade information(corehr:employment.job_grade:write)
job_family_id | string | The job family ID, enumeration value and detailed information can be obtained through the [Query a single job family](https://open.feishu.cn/document/server-docs/corehr-v1/job-management/job_family/get) interface query
probation_start_date | string | Probation period start date
probation_end_date | string | End date of probation period (actual end date)
primary_job_data | boolean | Whether to serve as the principal
employment_id | string | Employment ID
effective_time | string | Effective time
expiration_time | string | failure time
assignment_start_reason | enum | The reason for the appointment, the enumeration value can be obtained through the document [Enum constant](https://open.feishu.cn/document/server-docs/corehr-v1/feishu-people-enum-constant) The reason for appointment (assignment_start_reason) enumeration definition section<br>**Required field scopes**:<br>View reason field in employment history(corehr:job_data.assignment_start_reason:read)
enum_name | string | enumeration value
display | i18n\[\] | Enumerate multilingual display
lang | string | language
value | string | content
probation_expected_end_date | string | Expected end date of probation period
probation_outcome | enum | The probation period result, the enumeration value can be obtained from the enumeration definition section of the document [Enum constant](https://open.feishu.cn/document/server-docs/corehr-v1/feishu-people-enum-constant) probation period result (probation_outcome)
enum_name | string | enumeration value
display | i18n\[\] | Enumerate multilingual display
lang | string | language
value | string | content
direct_manager | basic_job_data | Direct manager
job_data_id | string | Job data ID
employment_id | string | Employment ID
dotted_line_managers | basic_job_data\[\] | Dotted-line manager
job_data_id | string | Job data ID
employment_id | string | Employment ID
second_direct_manager | basic_job_data | Second solid line supervisor
job_data_id | string | Job data ID
employment_id | string | Employment ID
cost_center_rates | job_data_cost_center\[\] | Cost center allocation information
cost_center_id | string | Cost center ID, you can obtain the corresponding cost center information through the [Inquire about cost center information](https://open.feishu.cn/document/server-docs/corehr-v1/organization-management/cost_center/search) interface
rate | int | Apportionment ratio
work_shift | enum | Shift type<br>**Required field scopes**:<br>Get work shift information(corehr:job_data.work_shift:read)
enum_name | string | enumeration value
display | i18n\[\] | enumeration multilingual presentation
lang | string | language
value | string | content
compensation_type | enum | Salary type<br>**Required field scopes**:<br>Get salary type(corehr:job_data.compensation_type:read)
enum_name | string | enumeration value
display | i18n\[\] | enumeration multilingual presentation
lang | string | language
value | string | content
service_company | string | Zhan Company<br>**Required field scopes**:<br>Get company of employment(corehr:job_data.service_company:read)
created_at | string | creation time
weekly_working_hours_v2 | number(float) | Weekly working hours V2
weekly_working_hours | int | weekly working hours
employee_subtype_id | string | Person subtype ID<br>- Function grey release, if you need it, please contact [technical support] (https://applink.feishu.cn/TLJpeNdW)
job_data_reason | enum | reason for appointment<br>- You can query through the [[Get Field Details]] (/ssl: ttdoc/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/custom_field/get_by_param) interface, the query parameters are as follows:<br>- object_api_name = "job_data"<br>- custom_api_name = "job_data_reason"<br>**Required field scopes**:<br>读取任职原因(corehr:job_data.job_data_reason:read)
enum_name | string | enumeration value
display | i18n\[\] | enumerated multilingual display
lang | string | Language coding (IETF BCP 47)
value | string | text content

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "items": [
            {
                "employment_id": "6893014062142064135",
                "job_datas": [
                    {
                        "job_data_id": "6890452208593372679",
                        "version_id": "6890452208593372697",
                        "employee_type_id": "6890452208593372679",
                        "working_hours_type_id": "6890452208593372679",
                        "work_location_id": "6890452208593372679",
                        "department_id": "6890452208593372679",
                        "position_id": "6890452208593372679",
                        "job_id": "6890452208593372679",
                        "job_level_id": "6890452208593372679",
                        "job_grade_id": "6890452208593372679",
                        "job_family_id": "1245678",
                        "probation_start_date": "2018-03-16T00:00:00",
                        "probation_end_date": "2019-05-24T00:00:00",
                        "primary_job_data": true,
                        "employment_id": "6893014062142064135",
                        "effective_time": "2020-05-01 00:00:00",
                        "expiration_time": "2020-05-02 00:00:00",
                        "assignment_start_reason": {
                            "enum_name": "phone_type",
                            "display": [
                                {
                                    "lang": "zh-CN",
                                    "value": "中文示例"
                                }
                            ]
                        },
                        "probation_expected_end_date": "2006-01-02",
                        "probation_outcome": {
                            "enum_name": "phone_type",
                            "display": [
                                {
                                    "lang": "zh-CN",
                                    "value": "中文示例"
                                }
                            ]
                        },
                        "direct_manager": {
                            "job_data_id": "1000000",
                            "employment_id": "6893014062142064135"
                        },
                        "dotted_line_managers": [
                            {
                                "job_data_id": "1000000",
                                "employment_id": "6893014062142064135"
                            }
                        ],
                        "second_direct_manager": {
                            "job_data_id": "1000000",
                            "employment_id": "6893014062142064135"
                        },
                        "cost_center_rates": [
                            {
                                "cost_center_id": "6950635856373745165",
                                "rate": 100
                            }
                        ],
                        "work_shift": {
                            "enum_name": "phone_type",
                            "display": [
                                {
                                    "lang": "zh-CN",
                                    "value": "中文示例"
                                }
                            ]
                        },
                        "compensation_type": {
                            "enum_name": "phone_type",
                            "display": [
                                {
                                    "lang": "zh-CN",
                                    "value": "中文示例"
                                }
                            ]
                        },
                        "service_company": "6890452208593372680",
                        "created_at": "2020-05-02 00:00:00",
                        "weekly_working_hours_v2": 10.1,
                        "weekly_working_hours": 10,
                        "employee_subtype_id": "6890452208593372680",
                        "job_data_reason": {
                            "enum_name": "phone_type",
                            "display": [
                                {
                                    "lang": "zh-CN",
                                    "value": "中文示例"
                                }
                            ]
                        }
                    }
                ]
            }
        ]
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 1160013 | Param is invalid | Please check if the parameter format is wrong
400 | 1160018 | AppID or LarkTenantID missing | Please check if AppID or LarkTenantID is filled in
400 | 1160023 | No authority error | Please check if you have permission.
500 | 1160999 | unknown error | Please contact technical support for investigation.
500 | 1160997 | Unknown meta rpc error | Please contact technical support for investigation.
500 | 1160998 | Unknown vault rpc error | Please contact technical support for investigation.

