# 添加

## **路由-添加**

* 接口名称：添加路由
* 请求方式：post
* 请求示例：[/rbac/routes](https://github.com/windhoney/yii2-rest-rbac/tree/5607a3fc72fd54f761435b601794fd2091885740/%7B%7Bbook.api_url%7D%7D/rbac/routes/README.md)
* 请求参数说明：

| 元素名称         | 数据类型   | 是否非空 | 元素说明   | 备注  |
| ------------ | ------ | ---- | ------ | --- |
| name         | string | 是    | 名称     | --- |
| description  | string | 是    | 路由     | --- |
| parent\_name | string | 否    | 路由父级名称 | --- |

## **添加示例：**

*   数据格式：数组

    ```php
    [
      {
          "name": "/admin/bcd",
          "description": "描述",
          "parent_name": "父级1"
      },
      {
          "name": "/admin/abc/index",
          "description": "描述123",
          "parent_name": "父级2"
      }
    ]
    ```

    **返回信息：**
* 数据格式：JSON
*   成功示例：

    ```php
    {
      "code": 200,
      "message": "OK",
      "data": [
          {
              "name": "/admin/*",
              "description": null
          },
          {
              "name": "/admin/abc/index1",
              "description": "这是描述12312"
          },
          {
              "name": "/admin/assignment/*",
              "description": null
          },
          {
              "name": "/admin/role/index",
              "description": null
          },
          {
              "name": "/admin/role/remove",
              "description": null
          },
          {
              "name": "/admin/role/update",
              "description": null
          }
      ]
    }
    ```
*   失败示例：

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