> ## 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.

# Mendapatkan cakupan izin Kontak seorang admin

> Panggil API DingTalk ini untuk mendapatkan Cakupan izin Kontak seorang administrator, termasuk daftar Departemen yang dapat dikelolanya.

Panggil API ini untuk mendapatkan Cakupan izin Kontak seorang admin.

## Permintaan

| **Informasi dasar**         |                                                                                                              |
| --------------------------- | ------------------------------------------------------------------------------------------------------------ |
| URL HTTP                    | [https://api.dingtalk.io/topapi/user/get\_admin\_scope](https://api.dingtalk.io/topapi/user/get_admin_scope) |
| Metode HTTP                 | POST                                                                                                         |
| Tipe aplikasi yang didukung | appType-Aplikasi internal, appType-Aplikasi perusahaan pihak ketiga                                          |
| Izin yang diperlukan        | permission-qyapi\_get\_member-Izin baca untuk informasi pengguna                                             |

### Parameter kueri

| Nama          | Tipe   | Wajib | Contoh   | Deskripsi                                                                                                                                                                                                                                                                                                                            |
| ------------- | ------ | ----- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| access\_token | String | Ya    | bE74xxxx | Kredensial aplikasi yang digunakan untuk memanggil API ini.   - Untuk Aplikasi internal, dapatkan melalui API untuk mendapatkan [access\_token aplikasi internal](/id/open/development/obtain-orgapp-token). - Untuk Aplikasi perusahaan pihak ketiga, dapatkan melalui API untuk mendapatkan access\_token perusahaan pihak ketiga. |

### Isi permintaan

| Nama   | Tipe   | Wajib | Contoh    | Deskripsi                                                                                                                                                                 |
| ------ | ------ | ----- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| userid | String | Ya    | manger123 | ID pengguna dari Admin. Panggil API [Mendapatkan daftar admin](/id/open/development/query-the-administrator-list) untuk mendapatkan ID admin di Organisasi Anda saat ini. |

### Contoh permintaan

```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);
```

## Respons

### Isi respons

| Nama        | Tipe      | Contoh       | Deskripsi                                            |
| ----------- | --------- | ------------ | ---------------------------------------------------- |
| request\_id | String    | zpucraudovy0 | ID permintaan.                                       |
| errcode     | Number    | 0            | Kode pengembalian.                                   |
| errmsg      | String    | ok           | Deskripsi kode pengembalian.                         |
| dept\_ids   | Number\[] | \[1]         | Daftar ID Departemen yang dapat dikelola oleh admin. |

### Contoh isi respons

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

### Kode error

Jika terjadi error saat Anda memanggil API ini, temukan solusinya di dokumen [Kode error global](/id/open/development/server-api-error-codes-1) berdasarkan pesan error.

| Kode error (errcode) | Pesan error (errmsg) | Solusi                                           |
| -------------------- | -------------------- | ------------------------------------------------ |
| 60121                | Employee not found   | Pastikan userId sudah benar.                     |
| 40036                | Parameter is empty   | Pastikan semua parameter wajib telah disediakan. |
| 400001               | System error         | Coba lagi nanti.                                 |
