List departments
Code Mode: praxis.workforce.departments.list
HTTP: GET /workforce/v1/departments
Lists the departments of your organization’s tree, including the root department; use it to find a department id or to walk the tree one level at a time with parent_id. Dissolved departments are included unless you filter status=active. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /workforce/v1/departments?status=active.
签名
praxis.workforce.departments.list(args?:{query?:{limit?:number;page?:string;parent_id?:string;status?:"active"|"dissolved"}}):Promise<{/** Departments on this page. */ data:Array<{/** Department id (dept_...); use it as department_id and parent_id. */ id:string;/** Id of the organization that owns the department. */ organization_id:string;/** Id of the parent department; null for the root department, which every organization has exactly once. */ parent_id:string|null;/** Department name, 1 to 100 characters; unique among the active departments under one parent; the root department carries the organization's name. */ name:string;/** Sort position among siblings; lower values come first. */ order:number;/** Id of the position that heads the department; null while no position has been designated head; the root department's head position is created with the organizat */ head_position_id:string|null;/** Whether the department is part of the tree or was dissolved. */ status:"active"|"dissolved";/** UTC instant (RFC 3339) when the department was established. */ create_time:string;/** UTC instant (RFC 3339) of the latest change to the department. */ update_time:string}>;/** Whether another page is available after this one. */ has_more:boolean;/** Cursor to pass as page to read the next page; null when no more items remain. */ next_page:string|null}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| limit | query | number | 否 | Maximum items per page, from 1 to 100; defaults to 20. |
| page | query | string | 否 | Opaque next_page cursor returned by the previous response; omit for the first page. |
| parent_id | query | string | 否 | Only departments whose parent is this department id (dept_…); the root department has no parent, so it never matches. |
| status | query | “active” | “dissolved” | 否 | Only departments in this status; omit to list active and dissolved departments together. |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | One page of departments. |
| 400 | application/problem+json | INVALID_PARAMS; an unknown query parameter, a limit outside 1 to 100, a bad filter value or a stale page cursor. The message lists the accepted parameters. |
| 401 | Missing or invalid credential; provide a valid organization API key or sign in to the Console. | |
| 403 | application/problem+json | PERMISSION_DENIED; an agent’s session token reads its own organization, but a run or computer token, or a session token that names no agent, is refused; call with an organization API key, a Console session, or the agent’s own session token. |