获取站点主题

Baklib
辉哥2 最后一次编辑 2 年多前
854

基本信息

接口名称: 获取站点主题

接口类型: 数据获取

接口说明: 获取站点所有主题

详细信息

URL

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

完整URL示例

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

HTTP请求方式

GET

授权认证方式

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

Authorization: Bearer <token>

请求参数

示例代码

require 'faraday'
require 'json'
host = 'https://www.baklib.com/'

client = Faraday.new(url: host) do |conn|
  conn.headers['Authorization'] = "Bearer #{token}"
  conn.headers['Content-Type'] = 'application/json'
  conn.adapter :net_http
end

response = client.get("/api/v1/global_layouts/tenants")
JSON.parse(response.body)

返回结果

{
  "code": 0,
  "status": "success",
  "message": [
    {
      "id": "48ce14fb-1e96-468c-9de6-e56805e1ab67",
      "name": "初遇如梦",
      "description": "这是一个时尚的模板",
      "kind": "help-center",
      "version": "2.0.3"
    },
    {
      "id": "5cbb4cbd-3cb0-4aa6-8d43-c781ed843661",
      "name": "浅末年华",
      "description": "这是一个时尚的模板",
      "kind": "knowledge-base",
      "version": "2.0.4"
    },
    {
      "id": "7280acaf-9a83-4799-9a6c-737fc9c219e5",
      "name": "一笔掠影",
      "description": "这是一个时尚的模板",
      "kind": "faq-document",
      "version": "2.0.4"
    },
    {
      "id": "900fcf73-9b94-412a-a6aa-d7652854b003",
      "name": "一纸华章",
      "description": "这是一个时尚的模板",
      "kind": "knowledge-base",
      "version": "2.0.3"
    },
    {
      "id": "098f4a21-56c1-47fe-b46c-7e12ad9ef474",
      "name": "轩墨成书",
      "description": "这是一个时尚的模板",
      "kind": "knowledge-base",
      "version": "2.0.3"
    },
    {
      "id": "d17dc200-1430-44b9-b85f-b57559ef26cb",
      "name": "外星天地",
      "description": "这是一个时尚的模板",
      "kind": "product-document",
      "version": "2.0.6"
    },
    {
      "id": "56138e27-077a-49cd-8588-efe601d3ea9c",
      "name": "清风拂柳",
      "description": "这是一个时尚的模板",
      "kind": "help-center",
      "version": "2.0.5"
    },
    {
      "id": "ba50f771-fe8e-4a43-8112-bce00de84f3f",
      "name": "一页成书",
      "description": "这是一个时尚的模板",
      "kind": "faq-document",
      "version": "2.0.5"
    },
    {
      "id": "0ef373a5-129b-41fb-9230-82ae9580f088",
      "name": "时日年华",
      "description": "这是一个时尚的模板",
      "kind": "product-document",
      "version": "2.0.5"
    },
    {
      "id": "007f30ea-3a98-41b5-b344-cd2715e90329",
      "name": "默听花语",
      "description": "这是一个时尚的模板",
      "kind": "help-center",
      "version": "2.0.7"
    }
  ]
}

返回字段说明

返回值字段 字段类型 说明
code Integer 状态码
status String 返回状态
id String 主题id
name String 主题名称
description String 主题描述
kind String 主题类型
version String 版本号