产品品牌 API
列出产品品牌
GET /products/brands
| 属性 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
context | 字符串 | 否 | 发起请求的范围;决定响应中包含的字段。 |
page | 整数 | 否 | 集合的当前页。默认为 1。 |
per_page | 整数 | 否 | 结果集中返回的最大项目数。默认为无限制。允许 0 到 100 之间的数值。 |
search | 字符串 | 否 | 将结果限制为匹配某个字符串的项目。 |
exclude | 数组 | 否 | 确保结果集排除特定的 ID。 |
include | 数组 | 否 | 将结果集限制为特定的 ID。 |
order | 字符串 | 否 | 升序或降序排序。允许的值:asc, desc。默认为 asc。 |
orderby | 字符串 | 否 | 按术语属性排序。允许的值:name, slug, count。默认为 name。 |
hide_empty | 布尔值 | 否 | 如果为 true,则不返回空术语。默认为 true。 |
parent | 整数 | 否 | 将结果限制为具有特定父级 ID 的项目。 |
curl "https://example-store.com/wp-json/wc/store/v1/products/brands"
示例响应:
[
{
"id": 16,
"name": "Nike",
"slug": "nike",
"description": "This is the Nike brand.",
"parent": 0,
"count": 11,
"image": {
"id": 55,
"src": "https://store.local/wp-content/uploads/2021/11/nike-logo.jpg",
"thumbnail": "https://store.local/wp-content/uploads/2021/11/nike-logo-324x324.jpg",
"srcset": "https://store.local/wp-content/uploads/2021/11/nike-logo.jpg 800w, https://store.local/wp-content/uploads/2021/11/nike-logo-324x324.jpg 324w, https://store.local/wp-content/uploads/2021/11/nike-logo-100x100.jpg 100w, https://store.local/wp-content/uploads/2021/11/nike-logo-416x416.jpg 416w, https://store.local/wp-content/uploads/2021/11/nike-logo-300x300.jpg 300w, https://store.local/wp-content/uploads/2021/11/nike-logo-150x150.jpg 150w, https://store.local/wp-content/uploads/2021/11/nike-logo-768x768.jpg 768w",
"sizes": "(max-width: 800px) 100vw, 800px",
"name": "nike-logo.jpg",
"alt": ""
},
"review_count": 2,
"permalink": "https://store.local/product-brand/nike/"
},
{
"id": 21,
"name": "Adidas",
"slug": "adidas",
"description": "",
"parent": 0,
"count": 1,
"image": null,
"review_count": 1,
"permalink": "https://store.local/product-brand/adidas/"
}
]
单个品牌
获取单个品牌信息。
GET /products/brands/:id
或者
GET /products/brands/:slug
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
identifier | 字符串 | 是 | 用于获取品牌的标识符。可以是品牌 ID 或别名。 |
curl "https://example-store.com/wp-json/wc/store/v1/products/brands/1"
或者
curl "https://example-store.com/wp-json/wc/store/v1/products/brands/adidas"
示例回复:
{
"id": 1,
"name": "Adidas",
"slug": "adidas",
"description": "",
"parent": 0,
"count": 1,
"image": null,
"review_count": 1,
"permalink": "https://store.local/product-brand/adidas/"
}