跳到主要内容

产品品牌 API

列出产品品牌

GET /products/brands
属性类型是否必需描述
context字符串发起请求的范围;决定响应中包含的字段。
page整数集合的当前页。默认为 1
per_page整数结果集中返回的最大项目数。默认为无限制。允许 0100 之间的数值。
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/"
}