> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取管理员通讯录权限范围

> 调用本接口可获取管理员的通讯录权限范围。

调用本接口获取管理员通讯录权限范围。

## 请求

| **基本信息**    |                                                                                                              |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| HTTP URL    | [https://api.dingtalk.io/topapi/user/get\_admin\_scope](https://api.dingtalk.io/topapi/user/get_admin_scope) |
| HTTP Method | POST                                                                                                         |
| 支持的应用类型     | appType-企业内部应用appType-第三方企业应用                                                                                |
| 权限要求        | permission-qyapi\_get\_member-成员信息读权限                                                                        |

### 查询参数

| 名称            | 类型     | 是否必填 | 示例值      | 描述                                                                                                                                       |
| ------------- | ------ | ---- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token | String | 是    | bE74xxxx | 调用该API的应用凭证。   - 企业内部应用，通过[获取企业内部应用的access\_token](/zh/open/development/obtain-orgapp-token)接口获取。 - 第三方企业应用，通过获取第三方企业的access\_token接口获取。 |

### 请求体

| 名称     | 类型     | 是否必填 | 示例值       | 描述                                                                                         |
| ------ | ------ | ---- | --------- | ------------------------------------------------------------------------------------------ |
| userid | String | 是    | manger123 | 管理员的userid，可调用[获取管理员列表](/zh/open/development/query-the-administrator-list)接口获取当前企业下的管理员ID。 |

### 请求示例

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/user/get_admin_scope" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=f928c8b2-5f41-4c92-908a-01fee1f20450' \
-d 'userid=manager7078'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/user/get_admin_scope");
OapiUserGetAdminScopeRequest req = new OapiUserGetAdminScopeRequest();
req.setUserid("manger123");
OapiUserGetAdminScopeResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import dingtalk.api

req=dingtalk.api.OapiUserGetAdminScopeRequest("https://api.dingtalk.io/topapi/user/get_admin_scope")

req.userid="manager7078"
try:
  resp= req.getResponse(access_token)
  print(resp)
except Exception,e:
  print(e)
```

PHP

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');

$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiUserGetAdminScopeRequest;
$req->setUserid("manager7078");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/user/get_admin_scope");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/user/get_admin_scope");
OapiUserGetAdminScopeRequest req = new OapiUserGetAdminScopeRequest();
req.Userid = "manager7078";
OapiUserGetAdminScopeResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## 响应

### 响应体

| 名称          | 类型        | 示例值          | 描述          |
| ----------- | --------- | ------------ | ----------- |
| request\_id | String    | zpucraudovy0 | 请求ID。       |
| errcode     | Number    | 0            | 返回码。        |
| errmsg      | String    | ok           | 返回码描述。      |
| dept\_ids   | Number\[] | \[1]         | 可管理的部门ID列表。 |

### 响应体示例

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "dept_ids": [
    1
  ],
  "errcode": 0,
  "errmsg": "ok",
  "request_id": "zpucraudovy0"
}
```

### 错误码

若调用该接口报错，可根据错误信息在[全局错误码](/zh/open/development/server-api-error-codes-1)文档中查找解决方案。

| 错误码（errcode） | 错误码描述（errmsg） | 解决方案          |
| ------------ | ------------- | ------------- |
| 60121        | 找不到员工         | 请确认userId是否正确 |
| 40036        | 参数为空          | 请确认必填参数填写完整   |
| 400001       | 系统错误          | 请稍后再试         |
