> ## 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://oapi.dingtalk.io/role/add\_role\_group](https://oapi.dingtalk.io/role/add_role_group) |
| HTTP Method   | POST                                                                                           |
| サポートされるアプリタイプ | appType-社内アプリ                                                                                  |
| 権限要件          | permission-qyapi\_manage\_addresslist-連絡先データ管理権限                                               |

### クエリパラメータ

| 名前            | タイプ    | 必須 | 例        | 説明                                                                                                           |
| ------------- | ------ | -- | -------- | ------------------------------------------------------------------------------------------------------------ |
| access\_token | String | はい | 6d1bxxxx | 本インターフェースを呼び出すためのアプリ認証情報。[社内アプリの access\_token 取得](/ja/open/development/obtain-orgapp-token)インターフェースから取得します。 |

### リクエストボディ

| 名前   | タイプ    | 必須 | 例  | 説明        |
| ---- | ------ | -- | -- | --------- |
| name | String | はい | 製造 | ロールグループ名。 |

### リクエスト例

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://oapi.dingtalk.io/role/add_role_group" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=e9df3de5-2ccb-4aaf-a685-04ba09fe746d' \
-d 'name=%E5%90%8D%E7%A7%B0'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
  DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/role/add_role_group");
  OapiRoleAddrolegroupRequest req = new OapiRoleAddrolegroupRequest();
  req.setName("製造");
  OapiRoleAddrolegroupResponse 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.OapiRoleAddrolegroupRequest("https://oapi.dingtalk.io/role/add_role_group")

req.name="名称"
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 OapiRoleAddrolegroupRequest;
$req->setName("名称");
$resp = $c->execute($req, $access_token, "https://oapi.dingtalk.io/role/add_role_group");
```

C#

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

req=dingtalk.api.OapiRoleAddrolegroupRequest("https://oapi.dingtalk.io/role/add_role_group")

  req.name="名称"
  try:
resp= req.getResponse(access_token)
  print(resp)
  except Exception,e:
print(e)
```

## レスポンス

### レスポンスボディ

| 名前      | タイプ    | 例          | 説明               |
| ------- | ------ | ---------- | ---------------- |
| errcode | Number | 0          | レスポンスコード。        |
| errmsg  | String | ok         | レスポンスコード ID。     |
| groupId | Number | 1560985325 | 作成されたロールグループ ID。 |

### レスポンスボディ例

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode":0,
  "groupId":1560985325,
  "errmsg":"ok"
}
```

### エラーコード

本インターフェースの呼び出しでエラーが発生した場合は、エラーメッセージをもとに[グローバルエラーコード](/ja/open/development/server-api-error-codes-1)ドキュメントから解決方法を検索してください。
