智能日志管理平台

  • 智能日志管理平台 > API 文档 > logkit Pro API >Tags

    Tags

    最近更新时间: 2018-09-26 11:57:43

    获取 tag 列表

    请求

    GET /v1/api/tags?name=<tagName>&agents=true&sort=sortKey&order=order&page=<pageNum>&size=<pageSize>&search=<search>
    

    返回值

    • 如果没有错误,返回:
    {
        "tags": [
            {
                "name": "<tag_name>",
                "agent_ids": ["id1", "id2"],
                "config_names1": ["name1", "name2"],
                "note": "<tags 备注>"
            },
            "agents": {
                 "<agent_id>"":{
                     "hostname": "<hostname>",
                     "ip": "<ip>",
                     ...
                 }
            }
        ],
        "totalSize": <totalSize>
    }
    
    • 如果有错误则返回相应错误

    添加 tag

    POST /v1/api/tags/<tag_name>
    Content-Type: application/json
    {
       "name": "<tag_name>",
       "note": "<tag 说明>",
       "config_names": ["<config_name1>"],
       "agent_ids": ["<agent_id1", "agent_id2"]
    }
    

    返回值

    • 如果没有错误,返回空
    • 如果有错误则返回相应错误

    参数说明

    • name 字段可有可无,最终会被链接中的 <tag_name> 替换掉

    更新 tag

    PUT /v1/api/tags/<tag_name>/note
    Content-Type: application/json
    {
       "note": "<tag 说明>"
    }
    

    返回值

    • 如果没有错误,返回空
    • 如果有错误则返回相应错误

    参数说明

    • 当前仅支持更新 note 字段

    分配 tag 给 agents

    POST /v1/api/tags/<tag_name>/agentids
    Content-Type: application/json
    {
       "agent_ids": ["<agent_id1>", "<agent_id2>"]
    }
    

    返回值

    • 如果没有错误,返回空
    • 如果有错误则返回相应错误

    解除 tag 与 agents 的关联

    DELETE /v1/api/tags/<tag_name>/agentids/batch?agentids=<agent_id1>,<agent_id2>
    

    返回值

    • 如果没有错误,返回空
    • 如果有错误则返回相应错误

    删除为 tags 分发的 configs

    DELETE /v1/api/tags/<tag_name>/configs/<config_name>
    

    返回值

    • 如果没有错误,返回空
    • 如果有错误则返回相应错误

    删除 tag

    DELETE /v1/api/tags/<tag_name>
    

    返回值

    • 如果没有错误,返回空
    • 如果有错误则返回相应错误

    删除多个 tag

    DELETE /v1/api/tags/batch?tag=<tag1>,<tag2>
    

    返回值

    • 如果没有错误,返回空
    • 如果有错误则返回相应错误
    以上内容是否对您有帮助?
  • Qvm free helper
    Close