Skip to content

获取 Google 数据分类列表

本接口使用 GET 方法,请求路径为:

GET https://api.seermartech.cn/v3/keywords_data/google/categories

该接口用于获取 Google Ads 数据支持的完整产品与服务分类列表。当前数据接口属于旧版能力,建议新项目优迁移至 Google Ads API 容接口。

计费说明

调用本接口不收取费用,响应中的 cost 通常为 0。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

本接口无需请求参数,也无需请求体。

响应结构

接口返回 JSON 数据 tasks 数组任务处理结果。

顶层字段

字段名类型说明
versionstring当前 API 版本
status_codeinteger通用状态码
status_messagestring通用状态说明
timestring请求执行耗时,单位为秒
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务数量
tasks_errorintegertasks 数组中返回错误的任务数量
tasksarray任务结果数组

任务字段

字段名类型说明
idstring任务唯一标识,采用 UUID 格式
status_codeinteger任务状态码,取值范围通常为 1000060000
status_messagestring任务状态说明
timestring任务执行耗时,单位为秒
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的数量
patharray请求 URL 路径
dataobjectGET 请求中使用的接口参数信息
resultarray分类结果数组

分类字段

字段名类型说明
category_codeinteger分类编码
category_namestring分类完整名称
category_code_parentinteger上级分类编码

例如:

json
{
  "category_code": 10178,
  "category_name": "Apparel Accessories",
  "category_code_parent": 10021
}

category_code_parent10021 时,对应的上级分类可能为:

json
{
  "category_code": 10021,
  "category_name": "Apparel"
}

请求示例

cURL

bash
curl --location --request GET \
  "https://api.seermartech.cn/v3/keywords_data/google/categories" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json"

PHP

php
<?php

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://api.seermartech.cn/v3/keywords_data/google/categories',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer smt_live_YOUR_KEY',
        'Content-Type: application/json',
    ],
]);

$response = curl_exec($ch);

if ($response === false) {
    echo '请求失败:' . curl_error($ch);
} else {
    $result = json_decode($response, true);

    if (($result['status_code'] ?? null) === 20000) {
        print_r($result);
    } else {
        echo '错误码:' . ($result['status_code'] ?? '未知');
        echo ',错误信息:' . ($result['status_message'] ?? '未知');
    }
}

curl_close($ch);

TypeScript

typescript
import axios from "axios";

axios
  .get("https://api.seermartech.cn/v3/keywords_data/google/categories", {
    headers: {
      Authorization: "Bearer smt_live_YOUR_KEY",
      "Content-Type": "application/json",
    },
  })
  .then((response) => {
    const result = response.data;

    if (result.status_code === 20000) {
      console.log(result);
    } else {
      console.error(
        `错误码:${result.status_code},错误信息:${result.status_message}`
      );
    }
  })
  .catch((error) => {
    console.error("请求失败:", error.response?.data || error.message);
  });

Python

python
import requests

url = "https://api.seermartech.cn/v3/keywords_data/google/categories"

headers = {
    "Authorization": "Bearer smt_live_YOUR_KEY",
    "Content-Type": "application/json",
}

response = requests.get(url, headers=headers)
result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        "错误码:%s,错误信息:%s"
        % (result.get("status_code"), result.get("status_message"))
    )

C#

csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

public static class Demos
{
    public static async Task GetGoogleCategories()
    {
        using var httpClient = new HttpClient();

        httpClient.DefaultRequestHeaders.Authorization =
            new AuthenticationHeaderValue("Bearer", "smt_live_YOUR_KEY");

        var response = await httpClient.GetAsync(
            "https://api.seermartech.cn/v3/keywords_data/google/categories"
        );

        var content = await response.Content.ReadAsStringAsync();
        var result = JObject.Parse(content);

        if ((int?)result["status_code"] == 20000)
        {
            Console.WriteLine(result);
        }
        else
        {
            Console.WriteLine(
                $"错误码:{result["status_code"]},错误信息:{result["status_message"]}"
            );
        }
    }
}

响应示例

json
{
  "version": "3.20191128",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.4305 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.1200 sec.",
      "cost": 0,
      "result_count": 2,
      "path": [
        "v3",
        "keywords_data",
        "google",
        "categories"
      ],
      "data": {
        "api": "keywords_data",
        "function": "categories",
        "se": "google"
      },
      "result": [
        {
          "category_code": 10021,
          "category_name": "Apparel",
          "category_code_parent": 0
        },
        {
          "category_code": 10178,
          "category_name": "Apparel Accessories",
          "category_code_parent": 10021
        }
      ]
    }
  ]
}

状态码

  • 20000:请求成功。
  • 状态码:请求或任务处理失败,原因请结合 status_message 判断。

实用场景

  • 构建分类选择器:在研究中展示完整的 Google 产品与服务分类,帮助用户按行业快速筛选数据。
  • 建立分类层级映射:利用 category_codecategory_code_parent 构建父子分类树,为 SEO规划和行业导航提供结构化数据。
  • 统一分析维度:将、搜索量和竞争度数据到标准分类,便于跨项目进行行业对比分析。
  • 自动同步分类字:定期拉取最新分类列表并更新本地数据库,手工维护分类编码导致的数据匹错误。

统一入口:官网 · LLM API · 控制台