# 列表

## **角色列表**

* 接口名称：角色列表
* 请求方式：get
* 请求示例：[/rbac/roles](https://github.com/windhoney/yii2-rest-rbac/tree/5607a3fc72fd54f761435b601794fd2091885740/%7B%7Bbook.api_url%7D%7D/rbac/roles/README.md)

## **返回信息：**

* 数据格式：JSON&#x20;
* data参数说明：

| 元素名称        | 数据类型   | 是否非空 | 元素说明 | 备注  |
| ----------- | ------ | ---- | ---- | --- |
| name        | string | 是    | 名称   | --- |
| description | string | 是    | 描述   | --- |
| ruleName    | string | 否    | 规则名称 | --- |
| type        | string | 否    | 类型ID | --- |
| data        | string | 否    | 数据   | --- |
| createdAt   | string | 否    | 创建时间 | --- |
| updatedAt   | string | 否    | 更新时间 | --- |

* 成功示例：&#x20;

```php
{
    "code": 200,
    "message": "OK",
    "data": [
        {
            "type": "1",
            "name": "客服角色",
            "description": "客服角色1234",
            "ruleName": null,
            "data": null,
            "createdAt": "1499851081",
            "updatedAt": "1499851081"
        },
        {
            "type": "1",
            "name": "测试角色",
            "description": "1",
            "ruleName": null,
            "data": 3,
            "createdAt": "1499399750",
            "updatedAt": "1499764146"
        },
        {
            "type": "1",
            "name": "管理员",
            "description": "这是管理员",
            "ruleName": null,
            "data": null,
            "createdAt": "1462957229",
            "updatedAt": "1463032637"
        }
    ]
}
```

* 失败示例：

```php
{
    "code": 400,
    "message": "操作失败",
}
```
