Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/role/simplelist |
| HTTP Method | POST |
| Supported app types | appType-Internal appappType-Third-party enterprise app |
| Required permissions | permission-qyapi_get_department_member-Read permission for department users in Contacts |
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 obtaining the access_token of an internal app. - For a third-party enterprise app, obtain it through the API for obtaining the access_token of a third-party enterprise. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| role_id | Number | Yes | 1203141 | The role ID. To get this value, call the Get the role list API and use the value of the id parameter. |
| size | Number | No | 20 | The page size. Note This parameter takes effect only when set together with the offset parameter. The default value is 20 and the maximum value is 100. |
| offset | Number | No | 0 | The pagination offset. Note This parameter takes effect only when set together with the size parameter. The offset starts from 0. |
Request example
curl -X POST "https://api.dingtalk.io/topapi/role/simplelist" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=d1812xxxxc53245' \
-d 'offset=0' \
-d 'role_id=1203141' \
-d 'size=20'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/role/simplelist");
OapiRoleSimplelistRequest req = new OapiRoleSimplelistRequest();
req.setRoleId(1203141L);
req.setSize(20L);
req.setOffset(0L);
OapiRoleSimplelistResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiRoleSimplelistRequest("https://api.dingtalk.io/topapi/role/simplelist")
req.role_id=1203141
req.offset=0
req.size=20
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 OapiRoleSimplelistRequest;
$req->setRoleId("1203141");
$req->setOffset("0");
$req->setSize("20");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/role/simplelist");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/role/simplelist");
OapiRoleSimplelistRequest req = new OapiRoleSimplelistRequest();
req.RoleId = 1203141L;
req.Offset = 0L;
req.Size = 20L;
OapiRoleSimplelistResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| request_id | String | f6249uw1kuus | The request ID. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| result | PageVo | The query result. | |
| hasMore | Boolean | true | Indicates whether more data is available. |
| list | OpenEmpSimple[] | The list of users assigned to the role. | |
| userid | String | manager4220 | The user ID of the user. |
| name | String | John | The name of the user. |
| manageScopes | OrgDeptVo[] | The management scope. | |
| dept_id | Number | 11 | The department ID. |
| name | String | Discipline Inspection Department | The department name. |
Response body example
{
"errcode": 0,
"result": {
"hasMore": false,
"list": [
{
"name": "John",
"userid": "manager4220",
"manageScopes":[
{
"dept_id":11,
"name":"Discipline Inspection Department"
}
]
}
]
},
"request_id": "f6249uw1kuus"
}
Error codes
If an error occurs when you call this API, look up the solution in the Global error codes document based on the error message.| Error code (errorcode) | Error message (errmsg) | Solution |
|---|---|---|
| 33011 | Invalid roleId | Check whether the roleId is correct. |
| 40069 | Invalid size | Adjust the page size. |
| 40068 | Invalid offset | Adjust the offset. |
| 400001 | System error | Try again later. |