产品品牌 API


目录

本 API 提供了访问产品品牌信息的接口。

功能描述:

该 API 允许您:

API 端点:

请求参数:

参数名 类型 描述 是否必选
brand_id int 品牌 ID。仅在 GET /api/v1/brands/{brand_id} 中使用。 否
query string 搜索关键词。仅在 GET /api/v1/brands 中使用。 否

响应格式:

响应以 JSON 格式返回。

示例:

错误处理:

API 使用标准的 HTTP 状态码来指示操作的成功或失败。

版本:

v1.0

注意事项:

列出产品品牌

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/"
	}
]

产品品牌列表

以下是产品品牌的列表。每个品牌都有一个名称、别名、描述、父级、计数、图像、评价计数和固定链接。

品牌信息

示例

以下是两个产品品牌的示例:

上传图像

您可以通过以下步骤上传图像:

  1. 点击“上传”按钮。
  2. 选择要上传的图像文件。
  3. 填写图像的标题、描述和 alt 文本。
  4. 点击“插入到内容”按钮。

调整图像大小

您可以通过以下方法调整图像大小:

更多信息

有关更多信息,请查看 WordPress 文档或联系技术支持。

您可以在本地服务器上查看日志文件,以获取更多信息。

请注意,Width 属性表示图像的宽度。Brand 属性表示品牌。Store 属性表示商店。Log 属性表示日志。In 预示着某个位置。and 连接两个词语。View 动作表示查看。

单个品牌

获取单个品牌信息。

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/"
}

版本号 #2
由 壳壳虫 创建于 2026-03-09 19:53:58 UTC
由 壳壳虫 更新于 2026-03-09 19:53:58 UTC