Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/role/getrolegroup |
| HTTP Method | POST |
| Supported app types | appType-Internal appappType-Third-party enterprise app |
| Required permissions | permission-qyapi_get_department_list-Read permission for Contacts department 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 organization. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| group_id | Number | Yes | 1507113580 | The ID of the role group. |
Request example
curl -X POST "https://api.dingtalk.io/topapi/role/getrolegroup" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=ab02axxxx7d770' \
-d 'group_id=1'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/role/getrolegroup");
OapiRoleGetrolegroupRequest req = new OapiRoleGetrolegroupRequest();
req.setGroupId(1507113580L);
OapiRoleGetrolegroupResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiRoleGetrolegroupRequest("https://api.dingtalk.io/topapi/role/getrolegroup")
req.group_id=1
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 OapiRoleGetrolegroupRequest;
$req->setGroupId("1");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/role/getrolegroup");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/role/getrolegroup");
OapiRoleGetrolegroupRequest req = new OapiRoleGetrolegroupRequest();
req.GroupId = 1L;
OapiRoleGetrolegroupResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| role_group | OpenRoleGroup | The role group information. | |
| roles | OpenRole[] | The list of roles. | |
| role_id | Number | 1507113580 | The role ID. |
| role_name | String | Supervisor | The role name. |
| group_name | String | Default | The role group name. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | 8lgzequlri0o | The request ID. |
Response example
{
"errcode": 0,
"errmsg": "ok",
"role_group": {
"group_name": "Default",
"roles": [
{
"role_name": "Owner",
"role_id": 1507113580
},
{
"role_name": "Supervisor",
"role_id": 1507113581
},
{
"role_name": "Super Admin",
"role_id": 1507113578
},
{
"role_name": "Sub Admin",
"role_id": 1507113579
}
]
},
"request_id": "8lgzequlri0o"
}
Error codes
If an error occurs when you call this API, refer to the Global error codes document to find a solution based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 400002 | Invalid parameter | Verify whether groupId is valid. |
| -1 | System is busy | Try again later. |