更新站点

Baklib
辉哥2 最后一次编辑 接近 2 年前
334

基本信息

接口名称: 更新一个站点的基本信息

接口类型: 数据更新

接口说明: 更新一个站点的基本信息

详细信息

URL

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

完整URL示例

https://www.baklib.com/api/v1/tenants/682c1cf8-41bf-4417-0000-3e682fb5174b

HTTP请求方式

PUT

授权认证方式

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

Authorization: Bearer <token>

请求参数

参数 必选 类型及范围 说明
id true String 站点id
name false String 站点名称
identifier false String 站点二级域名
icp_info false String 备案信息
global_layout_id false String 站点模版id

示例代码

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
params = {
  name: '接口开发文档说明',
  identifier: 'new-path',
  icp_info: '蜀ICP备15035023号 - 13'
}
response = client.put("/api/v1/tenants/682c1cf8-41bf-4417-aa05-3e682fb5174b", params.to_json)
JSON.parse(response.body)

返回结果

{
  "code": 0,
  "status": "success",
  "message": {
    "id": "682c1cf8-41bf-4417-aa05-3e682fb5174b",
    "name": "接口开发文档说明",
    "identifier": "new-path",
    "domain": null,
    "site_title": null,
    "site_slogan": null,
    "site_logo": null,
    "site_icon": null,
    "site_color": null,
    "created_at": "2020-04-01T11:10:15.736+08:00",
    "updated_at": "2020-04-01T11:36:27.919+08:00",
    "user": {
      "id": "5b062111-13d7-41a2-0000-f3e0de23c98c",
      "mobile_phone": "13800000000",
      "name": "hello",
      "image": "https://example.com/avatar.png",
      "email": null
    },
    "access_level": 0,
    "site_header_image": null,
    "icp_info": "蜀ICP备xxxx号",
    "plan": 0,
    "plan_expires_at": null,
    "site_header_mask": null,
    "allow_robots": false
  }
}

返回字段说明

返回值字段 字段类型 说明
code Integer 状态码
status String 返回状态
id String 站点id
name String 站点名称
identifier String 站点唯一标识符
domain String 二级域名
site_title String 网站名称 (可能是多余字段)
site_slogan String 宣传标语
site_logo String 站点logo
site_icon String 导航栏logo
site_color String 站点主题颜色
created_at Datetime 创建时间
updated_at Datetime 更新时间
user Obj 站点所有者
      id String 用户id
      mobile_phone String 用户手机号
      name String 用户名称
      image String 用户头像
      email String 用户邮箱
access_level Integer 访问类型
site_header_image String 标语图片
icp_info String 备案信息
plan Integer 购买的版本
plan_expires_at Datetime 版本到期时间
site_header_mask String 标语图蒙版颜色
allow_robots boolean 允许搜索引擎收录