# 标签

# 标签列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/tags

# 参数说明:

支持分页参数和排序:(通用说明?

支持时间范围过滤

参数 是否必须 默认值 说明
page 1 当前页数
per_page 20 每页返回的数量

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('tags',[
    'page' => 1,
    'per_page' => 20
]);

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "tag",
            "id": "cf4e964851f211eaa03e0a58ac1300a3",
            "attributes": {
                "name": "标签",
                "recommended_at": "2020-01-02 13:14:15"
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/tags?per_page=20&page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/tags?per_page=20&page=329",
        "prev": null,
        "next": "https://lxapi.lexiangla.com/cgi-bin/v1/tags?per_page=20&page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 329,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/tags",
        "per_page": 2,
        "to": 2,
        "total": 657
    }
}

# 参数说明:

参数 说明
name 标签名称
recommended_at 标签推荐时间,null 表示未推荐
question_count 问题数
doc_count 文档数
document_subscribers_count 文档订阅人数
question_subscribers_count 问题订阅人数

# 获取用户订阅标签列表

# 接口调用说明:

GET http://lxapi.lexiangla.com/cgi-bin/v1/staffs/{staff_id}/subscribed-tags?target_type={target_type}

# 参数说明:

参数 是否必须 默认值 说明
staff_id 员工帐号
target_type question获取订阅的乐问标签,doc获取订阅的文档标签

# 响应document

# 200 OK 状态码
{
  "data": [
    {
      "attributes": {
        "name": "标签名称"
      }, 
      "id": "tag_id", 
      "type": "tag"
    }
  ]
}

# 参数说明:

参数 说明
name 标签名称
id 标签ID

# 订阅标签

# 接口调用说明:

POST https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{staffs_id}/relationships/subscribed-tags?target_type={target_type}

# 请求document

{
  "data": [
    {
      "type": "tag", 
      "id": "tag_id"
    }, 
    {
      "type": "tag", 
      "id": "tag_id2"
    }
  ]
}

# 参数说明:

参数 是否必须 默认值 说明
staffs_id 员工账号
target_type question表示新增订阅乐问标签,doc表示新增订阅文档标签
type type是固定的"tag"
tag.id 标签ID,最多支持新增订阅10个标签
# 204 No Content 状态码

# 取消订阅标签

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{staff_id}/relationships/subscribed-tags?target_type={target_type}

# 请求document

{
  "data": [
    {
      "type": "tag", 
      "id": "tag_id"
    }, 
    {
      "type": "tag", 
      "id": "tag_id2"
    }
  ]
}

# 参数说明:

参数 是否必须 默认值 说明
staff_id 员工帐号
target_type question表示取消订阅乐问标签,doc表示取消订阅文档标签
type type是固定的"tag"
tag.id 标签ID,最多支持取消订阅10个标签
# 204 No Content 状态码