Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/user/get_admin_scope |
| HTTP Method | POST |
| Supported app types | appType-Internal app, appType-Third-party enterprise app |
| Required permissions | permission-qyapi_get_member-Read permission for user information |
Query parameter
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | bE74xxxx | The App credential used to call this API. - For an Internal app, obtain it through the API for getting the access_token of an internal app. - For a Third-party enterprise app, obtain it through the API for getting the access_token of a third-party enterprise. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| userid | String | Yes | manger123 | The user ID of the Admin. Call the Get the admin list API to get the admin IDs in your current Organization. |
Request example
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'
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());
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)
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");
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);
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| request_id | String | zpucraudovy0 | The request ID. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| dept_ids | Number[] | [1] | The List of Department IDs that the admin can manage. |
Response body example
{
"dept_ids": [
1
],
"errcode": 0,
"errmsg": "ok",
"request_id": "zpucraudovy0"
}
Error codes
If an error is returned when you call this API, find the solution in the Global error codes document based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 60121 | Employee not found | Confirm whether the userId is correct. |
| 40036 | Parameter is empty | Confirm that all required parameters are provided. |
| 400001 | System error | Try again later. |