API call description
For example, in the Smart HR app of an organization, the resignation records from June 1, 2022 to June 7, 2022 are shown below. The resignation date of employee Xiaoding 2 is June 7, 2022, and the resignation date of DingTalk Test is June 7, 2022. Call this API to query the resignation records from June 1, 2022 to June 7, 2022, and you can retrieve information such as the time when employees Xiaoding 2 and DingTalk Test left the organization, their phone numbers, and how they left the organization.Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/contact/empLeaveRecords |
| HTTP Method | GET |
| Supported app type | appType-Internal app |
| Required permission | permission-Contact.Common.Read-Read permission for basic Contacts data |
Request header
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. To obtain it, call the Get the access token of an internal app API. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| startTime | String | Yes | The start time. Format: YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). |
| endTime | String | No | The end time. Format: YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). - If this parameter is not specified, the start time must be within 365 days of the current time. - If this parameter is specified, the interval between the start time and end time must not exceed 365 days. |
| nextToken | String | No | The pagination cursor. - For the first query, set this parameter to 0. - For subsequent queries, set this parameter to the nextToken value returned by the previous call to this API. |
| maxResults | Integer | Yes | The maximum number of entries per page. Maximum value: 50. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| nextToken | String | The pagination token for the next request. |
| records | Array | The list of resignation records. |
| userId | String | The userId of the employee. |
| name | String | The name of the employee. |
| stateCode | String | The international dialing code. |
| mobile | String | The phone number. |
| leaveTime | String | The time when the employee left the organization. Format: YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). |
| leaveReason | String | The way the employee left the organization. Valid values: - oapi: Deleted by an API call. - cancel: Account canceled. - leave: Voluntary resignation. - unknown: Unknown reason. - delete: Deleted by the admin. |
Response body example
Error codes
If an error occurs when calling this API, refer to the Global error codes document to find a solution based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | invalidParameter.param.invalid | Invalid parameter: %s | Invalid parameter |
| 500 | system.error | System error | System error |