Department Batch Import APIAPI Explorer
Introduction
API Introduction
Department Batch Import API enables to use 'dept_no' (department ID) as the primary key and fully replaces the department tree in the enterprise's contacts.
API Version
API Version | Updated Time | Version Description |
V1 | 2022.10.28 | The API request frequency is increased from five times/second to ten times/second. The API route is changed to POST corp/department/dept_no/import. |
API Calling
Request URL: https://api.jodoo.com/api/v5/corp/department/import
Request frequency: 10 times/second
Request Method: POST
Notes:
1. The department ID is a unique numeric identifier.
2. Except for the root department, all departments must have a parent department that exists. If the root department does not exist in the new imported list, the system will automatically insert the root department with the name of the enterprise.
3. Sibling departments cannot have the same name.
4. The department hierarchy cannot exceed 16 levels.
5. If the imported data and the user exist in the contacts, you can update the department information.
6. If the imported data exists, but the user does not exist in the existing contacts, you can add the department to Jodoo.
7. If the imported data does not exist, but the department already exists in the company contacts, the system will check whether there are sub-departments and members in the department. If there are none, the department will be automatically deleted. If there are sub-departments and/or members, they will be moved to the root department and retained.
8. This API allows a maximum of 100,000 departments to be imported.
9. When calling the API, you cannot call other APIs to perform actions such as updating, deleting, or adding on your contacts.
Request Parameters:
Parameter | Required | Type | Description |
Departments | Yes | Array | Department list |
departments[].dept_no | Yes | Number | Department ID (upper limit: 9007199254740991) |
departments[].name | Yes | String | Department name |
departments[].parent_no | No | Number | If the parent department ID parameter is not passed when you create a department, the system will automatically set the department as a sub-department of the root department. |
Sample Request:
{
"departments": [{
"dept_no": 11,
"name": "Finance department",
"parent_no": 1
}, {
"dept_no": 12,
"name": "Finance department",
"parent_no": 1
}]
}
Note:
When you use the API to batch import departments, it is necessary to specify the root department of the new departments to ensure the integrity of the department structure.
For example, if you want to insert a new sub-department under the 'SSO_dept' department, you need to specify the parent department as well, otherwise an error will be reported indicating that the parent department does not exist.
In this case, it is necessary to include the 'SSO_dept' department as a parameter even if it already exists. This is to ensure the integrity of the department tree structure and the accurate insertion of the new sub-department.
Responses:
Parameter | Type | Description |
status | String | Return Request Results |
{
"status": "success"
}