# ProductCategory

> 商城或店铺里的一个商品类目。

网页版：https://okdata.online/zh/docs/objects/product_category/

所有平台同一种结构。平台没有的字段为 null，meta.unavailable 会说明原因。用 fields= 只取需要的字段。

| 字段 | 类型 | 说明 |
|---|---|---|
| `id` | string | 类目 ID，按类目列商品的接口直接用它。 |
| `name` | string | 类目名称。 |
| `name_en` | string \| null | 英文名（有的话）。 |
| `parent_id` | string \| null | 上级类目；顶级为 null。 |
| `level` | integer \| null | 层级，顶级为 1。 |
| `has_children` | boolean \| null | 是否还有子类目。 |
| `products` | integer \| null | 类目下的商品数（店铺给出时）。 |
| `ext` | object | 平台特有字段，只在 view=full 时返回。 |

## 返回 ProductCategory 的接口

- [1688 类目](https://okdata.online/zh/apis/alibaba_1688/categories/list/) (`alibaba_1688.categories.list`): $0.022/次 · 每页约 52 条结果
- [1688 店铺分类](https://okdata.online/zh/apis/alibaba_1688/shops/categories/list/) (`alibaba_1688.shops.categories.list`): $0.022/次 · 每页约 10 条结果

## 各 view 返回的字段

每一级 view 都包含上一级的字段。`view=compact` 最精简；`full` 会在 `ext` 里加上平台特有字段。

- compact：`id`, `name`, `name_en`, `parent_id`, `level`, `has_children`, `products`
- standard：—
- full：`ext`
