You need to enable JavaScript to run this app.
导航

内容标签信息获取

最近更新时间2023.11.30 14:32:13

首次发布时间2022.12.09 13:28:08

概述

内容标签信息获取接口主要用于客户侧获取标签元数据信息列表,共分为两种方式:

  • 通过内容ID获取内容标签信息,内容ID是内容推荐接口返回的ID;

  • 通过OpenId获取内容标签信息,OpenId是外部业务主键ID。

内容标签信息获取接口为非必须对接接口,客户侧可按需对接。

调前准备

  1. 接口鉴权
    详见:接口鉴权
  2. 调用接口
    注意参数 是否必填,使用正确的ServiceName、Action、Version 等url信息
    详见:下方接口信息
通过内容ID获取内容标签信息

请求接口

请求方式

post

请求url:

https://cms.volcengineapi.com?Action=TagListArticleTag&Version=2021-01-01

请求header:

ServiceName: volc_content_platform

url组成:

Host: https://cms.volcengineapi.com

Action: TagListArticleTag

Version: 2021-01-01

请求参数

字段名

字段类型

是否必填

说明

GroupIds

list< string>

内容id列表,列表大小最大为100

TagType

string

标签类型,支持系统标签/自定义标签/全部类型标签的查询
可选值:"system"/"custom",若不填则获取全部标签信息

响应字段

字段名
字段类型
是否必填
说明
ResponseMetadata
ResponseMetadata
Result
ListArticleTagResult
请求结果

请求示例

{
    "GroupIds":["1751615521577047"],
    "TagType":""
}

响应示例

正常响应示例

{
    "ResponseMetadata": {
        "RequestId": "20221208210936010208165106043E68FE",
        "Action": "TagListArticleTag",
        "Version": "2021-01-01",
        "Service": "volc_content_platform",
        "Region": "cn-north-1"
    },
    "Result": {
        "ArticleHierarchyTagInfos": {
            "1751615521577047": [
                {
                    "TagId": 1751640160012397,
                    "TagName": "test_levelN+1",
                    "TagIdentity": "test_N+1级标签",
                    "TagLevel": 3,
                    "ParentTagId": 1751639533756477,
                    "ParentTagIdentity": "test_子级标签",
                    "TagType": "system",
                    "TagScore": 0.8921681530836807
                    
                },
                {
                    "TagId": 1744738298126344,
                    "TagName": "custom.根标签",
                    "TagIdentity": "custom.rootid",
                    "TagLevel": 1,
                    "ParentTagId": 0,
                    "ParentTagIdentity": "",
                    "TagType": "system",
                    "TagScore": 1
                },
                {
                    "TagId": 1751639533756477,
                    "TagName": "test_levelN",
                    "TagIdentity": "test_子级标签",
                    "TagLevel": 2,
                    "ParentTagId": 1744738298126344,
                    "ParentTagIdentity": "custom.rootid",
                    "TagType": "system",
                    "TagScore": 1
                },
                ...
            ]
        }
    }
}

异常响应示例

{
    "ResponseMetadata": {
        "RequestId": "2022120821143201020812106726357D56",
        "Action": "TagListArticleTag",
        "Version": "2021-01-01",
        "Service": "volc_content_platform",
        "Region": "cn-north-1",
        "Error": {
            "CodeN": 600400,
            "Code": "600400",
            "Message": "标签类型不合法"
        }
    },
    "Result": null
}

通过OpenId获取内容标签信息

请求接口

请求方式

post

请求url:

https://cms.volcengineapi.com?Action=TagListArticleTagByOpenId&Version=2021-01-01

请求header:

ServiceName: volc_content_platform

url组成:

Host: https://cms.volcengineapi.com

Action: TagListArticleTagByOpenId

Version: 2021-01-01

请求参数

字段名字段类型是否必填说明

OpenId

string

外部业务主键ID

GenerateTypestringApi源标识,取值详见:Api源标识

TagType

string

标签类型,支持系统标签/自定义标签/全部类型标签的查询
可选值:"system"/"custom",若不填则获取全部标签信息

响应字段

字段名
字段类型
是否必填
说明
ResponseMetadata
ResponseMetadata
Result
ListArticleTagByOpenIdResult
请求结果

请求示例

{
    "OpenId": "7128331636910900780",
    "GenerateType": "zhihu",
    "TagType": "system"
}

响应示例

正常响应示例

{
    "ResponseMetadata": {
        "RequestId": "20230925180624DC5F4A459E4AD01EFCB5",
        "Action": "TagListArticleTagByOpenId",
        "Version": "2021-01-01",
        "Service": "volc_content_platform",
        "Region": "cn-north-1"
    },
    "Result": {
        "ArticleHierarchyTagInfo": [
            {
                "TagId": 1738773994801230,
                "TagName": "通用模型",
                "TagIdentity": "",
                "TagLevel": 1,
                "ParentTagId": 0,
                "ParentTagIdentity": "",
                "TagType": "system",
                "TagScore": 1
            },
            {
                "TagId": 1738774021485607,
                "TagName": "文本情感",
                "TagIdentity": "",
                "TagLevel": 2,
                "ParentTagId": 1738773994801230,
                "ParentTagIdentity": "",
                "TagType": "system",
                "TagScore": 1
            },
            {
                "TagId": 1738774021656718,
                "TagName": "情感偏正向",
                "TagIdentity": "",
                "TagLevel": 3,
                "ParentTagId": 1738774021485607,
                "ParentTagIdentity": "",
                "TagType": "system",
                "TagScore": 0.97824
            }
        ]
    }
}

异常响应示例

{
    "ResponseMetadata": {
        "RequestId": "20230925180652DC5F4A459E4AD01F1A3B",
        "Action": "TagListArticleTagByOpenId",
        "Version": "2021-01-01",
        "Service": "volc_content_platform",
        "Region": "cn-north-1",
        "Error": {
            "CodeN": 600450,
            "Code": "600450",
            "Message": "文章不存在"
        }
    },
    "Result": null
}