获取栏目详情

基本信息

接口名称: 获取栏目详细信息

接口类型: 数据获取

接口说明: 获取某个栏目的详细信息

详细信息

URL

https://www.baklib.com/api/v1/channels/:id

完整URL示例

https://www.baklib.com/api/v1/channels/1dfbdd9d-5b9d-4961-8fae-eed05f6563ce?tenant_id=aaa24dbe-a17b-4439-911d-176e0149cf76

HTTP请求方式

GET

授权认证方式

默认方式,需要添加请求header

Authorization: Bearer <token>

请求参数

参数 必选 类型及范围 说明
id true String 栏目id
tenant_id true String 站点id

示例代码



var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://www.baklib.com/api/v1/channels/1dfbdd9d-5b9d-4961-8fae-eed05f6563ce?tenant_id=aaa24dbe-a17b-4439-911d-176e0149cf76");
xhr.setRequestHeader("Authorization", "Bearer 8486df9cb8a93ea843702141065c4a8b714602b45e7c4a6bb26a26ea3d69de6");


xhr.send();

返回结果

{
    "code": 0,
    "status": "success",
    "message": {
        "id": "1dfbdd9d-5b9d-4961-8fae-eed05f6563ce",
        "parent_id": "38a4383f-9249-44b7-8531-6c9c35529aac",
        "name": "baba",
        "identifier": "xiaohui4",
        "description": null,
        "ordinal": 0,
        "status": 1,
        "status_name": "发布",
        "kind": 1,
        "kind_name": "栏目",
        "slug": "xiaohui4",
        "tenant_id": "aaa24dbe-a17b-4439-911d-176e0149cf76",
        "visits_count": 0,
        "created_at": "2022-11-07T17:32:10.267+08:00",
        "updated_at": "2022-11-09T11:18:38.108+08:00",
        "created_by": "822ca2a8-b3b7-4d7c-aaed-8cd3b221373f",
        "updated_by": "822ca2a8-b3b7-4d7c-aaed-8cd3b221373f",
        "password": "1",
        "access_level": 0,
        "variables": {},
        "variables_description": [],
        "frontend_url": "XXX",
        "ordinal_type": 0,
        "icon_name": "fa fa-apple",
        "channel_template": "channel.default",
        "article_template": "article.theme_preview",
        "edit_url": "XX"
    }
}

返回字段说明

返回值字段 字段类型 说明
code Integer 状态码
status String 返回状态
message Hash 数据
        id String 栏目id
        parent_id String 父级栏目id
        name String 栏目名称
        identifier String 栏目唯一标识符
        description String 描述
        ordinal Integer 次序
        status Integer 栏目状态
        status_name String 栏目状态中文名称
        kind Integer 栏目种类
        kind_name String 栏目种类中文名称
        slug String 路径
        tenant_id String 站点id
        created_at Datetime 创建时间
        updated_at Datetime 更新时间
        created_by String 创建者id
        updated_by String 更新者id
        password String 密码
        access_level Integer 访问等级
        variables Jsonb 其他变量
        variables_description Array[String] 变量描述
        frontend_url String 前端访问地址
        ordinal_type String 排序种类
        icon_name String 图标
        channel_template String 栏目模板
        article_template String 文章模板
        edit_url String 编辑地址
2022-11-18
0 0