Getting a List of Departments (Page-by-Page)
AVAILABLE WITH BUSINESS SUBSCRIPTION
Request: GET /departments
Permissions to Run the Request
Account Owner, Account Administrators, Department Administrators, Publishers, or custom roles.
Department Administrators, Publishers,andusers with a custom role can get information about departments they manage and their sub-departments.
Request Headers
Header | Description |
---|---|
Authorization (required) | Access token. You can obtain a token by making a request. |
Parameter | Description |
pageSize (optional) | The number of entries per page. If not indicated, equal to 1000. |
pageToken (optional) | The token needed to continue to the next page. |
Response Parameters
Parameter | Description | |
---|---|---|
departmentId | The department ID. | |
name | The name of department. | |
code | The department code. | |
subordination (optional) | An array with data on the type of department supervisor subordination. | |
coSubordination (optional) | An array with data on the type of functional manager subordination. | |
subordinationType (required) | The type of supervisor and functional manager subordination.
| |
supervisorId (optional) | The supervisor and functional manager ID. | Specify the supervisor ID, if subordinationType = manual. |
- | If subordinationType = inherit, no_supervisor, there is no need to specify the supervisor ID. |
Response Codes
Code | Text | Description |
---|---|---|
200 | OK | The request has been successfully processed. The response body contains the XML data regarding departments. |
400 | Bad Request | A request error. |
401 | Unauthorized | An authorization error. |
403 | Permission Denied | The user doesn't have enough permissions to retrieve a list of departments. |
Sample Request
GET /departments?pageSize=1000&pageToken=ODE1YjhiOTgtMDYxMi0xMWVhLTliZDYtMGE1ODBhZjQwNzg4
Host: api-learn.ispringlearn.com
Authorization: p-1sJDjmULL5DdpXPJTcbm4jVIaWVHvNmrjAxATRbNE
XML
Sample Response
https/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<response>
<departments>
<department>
<departmentId>2a3e04a2-fa51-11e9-90a8-0a580af40a83</departmentId>
<name>Sample Company, LLC</name>
<code>0</code>
</department>
</departments>
<nextPageToken>MmEzZTA0YTItZmE1MS0xMWU5LTkwYTgtMGE1ODBhZjQwYTgz</nextPageToken>
</response>
XML