获取用户相关的站点列表

基本信息

接口名称: 获取用户相关的站点列表

接口类型: 数据获取

接口说明: 获取某个用户所相关的站点列表

详细信息

URL

https://www.baklib.com/api/v1/tenants

完整URL示例

https://www.baklib.com/api/v1/tenants

HTTP请求方式

GET

授权认证方式

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

Authorization: Bearer <token>

请求参数

参数 必选 类型及范围 说明
name false String 通过站点标题搜索
identifier false String 通过栏目唯一标识搜索
domain false String 通过域名搜索

示例代码


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/tenants");
xhr.setRequestHeader("Authorization", "Bearer 8486df9cb8a93ea843702141065c4a8b714602b45e7c4a6bb26a26ea3d69de6");

xhr.send();

返回结果

{
    "code": 0,
    "status": "success",
    "message": {
        "current_tenants": [
            {
                "id": "df9d0752-cbaf-4af5-9635-30716721baa0",
                "name": "测试1109",
                "identifier": "7260fe",
                "domain": null,
                "site_title": null,
                "site_logo": null,
                "site_icon": null,
                "site_color": "#03c9a9",
                "created_at": "2022-11-09T09:47:41.117+08:00",
                "updated_at": "2022-11-09T09:47:42.333+08:00",
                "user": {
                    "id": "822ca2a8-b3b7-4d7c-aaed-8cd3b221373",
                    "mobile_phone": "13518493758",
                    "name": "xinrong_li",
                    "image": "https://saas.bk-cdn.com/1667800960782-v2-454fba3b1159d364b448f77e092aef74.jpg",
                    "email": null
                },
                "icp_info": null,
                "plan": "套餐一",
                "plan_expires_at": "2022-11-23T09:47:41.881+08:00",
                "allow_robots": false,
                "member_role": [
                    "可以管理"
                ]
            }
        ],
        "share_tenants": []
    }
}

返回字段说明

返回值字段 字段类型 说明
code Integer 状态码
status String 返回状态
message Hash 返回数据
    current_tenants Array[String] 当前拥有的站点
        id String 站点id
        name String 站点名称
        identifier String 站点唯一标识符
        domain String 二级域名
        site_title String 网站名称 (可能是多余字段)
        site_logo String 站点logo
        site_icon String 导航栏logo
        site_color String 站点主题颜色
        created_at Datetime 创建时间
        updated_at Datetime 更新时间
        user Jsonb 站点所有者信息
              id String 用户id
              mobile_phone String 用户手机号
              name String 用户名称
              image String 用户头像
              email String 用户邮箱
        icp_info String 备案信息
        plan Integer 购买的套餐
        plan_expires_at Datetime 套餐到期时间
        allow_robots boolean 是否允许搜索引擎收录
        member_role Array[String] 用户权限
    share_tenants Array[String] 共享的站点
2022-11-18
1 0