Skip to content

Commit 820f0dc

Browse files
authored
Merge pull request #275 from woocommerce/fix/update-brand-documentation
Add brands property to product API documentation
2 parents 6eb62a8 + da0cdb0 commit 820f0dc

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

source/includes/v3/_products.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ This section lists all API endpoints that can be used to create, edit or otherwi
5858
| `parent_id` | integer | Product parent ID (post_parent) |
5959
| `categories` | array | List of product categories names (`string`). In write-mode need to pass a array of categories IDs (`integer`) ([uses wp_set_object_terms()](http://codex.wordpress.org/Function_Reference/wp_set_object_terms)) |
6060
| `tags` | array | List of product tags names (`string`). In write-mode need to pass a array of tags IDs (`integer`) ([uses wp_set_object_terms()](http://codex.wordpress.org/Function_Reference/wp_set_object_terms)) |
61+
| `brands` | array | List of product brands. See [Brands Properties](#brands-properties). In write-mode pass an array of brand objects with `id` property ([uses wp_set_object_terms()](http://codex.wordpress.org/Function_Reference/wp_set_object_terms)) |
6162
| `images` | array | List of products images. See [Images Properties](#images-properties) |
6263
| `featured_src` | string | Featured image URL <i class="label label-info">read-only</i> |
6364
| `attributes` | array | List of product attributes. See [Attributes Properties](#attributes-properties). Note: the attribute must be registered in WooCommerce before. |
@@ -103,6 +104,14 @@ This section lists all API endpoints that can be used to create, edit or otherwi
103104
<code>alt</code> and <code>title</code> attributes are writable starting from WooCommerce 2.5.
104105
</aside>
105106

107+
### Brands Properties ###
108+
109+
| Attribute | Type | Description |
110+
| --------- | ------- | -------------------------------------------------------------------------------------- |
111+
| `id` | integer | Brand ID <i class="label label-info">required for write operations</i> |
112+
| `name` | string | Brand name <i class="label label-info">read-only</i> |
113+
| `slug` | string | Brand slug <i class="label label-info">read-only</i> |
114+
106115
### Attributes Properties ###
107116

108117
| Attribute | Type | Description |
@@ -197,6 +206,14 @@ curl -X POST https://example.com/wc-api/v3/products \
197206
9,
198207
14
199208
],
209+
"brands": [
210+
{
211+
"id": 15
212+
},
213+
{
214+
"id": 16
215+
}
216+
],
200217
"images": [
201218
{
202219
"src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
@@ -223,6 +240,14 @@ var data = {
223240
9,
224241
14
225242
],
243+
brands: [
244+
{
245+
id: 15
246+
},
247+
{
248+
id: 16
249+
}
250+
],
226251
images: [
227252
{
228253
src: 'http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg',
@@ -254,6 +279,14 @@ $data = [
254279
9,
255280
14
256281
],
282+
'brands' => [
283+
[
284+
'id' => 15
285+
],
286+
[
287+
'id' => 16
288+
]
289+
],
257290
'images' => [
258291
[
259292
'src' => 'http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg',
@@ -283,6 +316,14 @@ data = {
283316
9,
284317
14
285318
],
319+
"brands": [
320+
{
321+
"id": 15
322+
},
323+
{
324+
"id": 16
325+
}
326+
],
286327
"images": [
287328
{
288329
"src": "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
@@ -311,6 +352,14 @@ data = {
311352
9,
312353
14
313354
],
355+
brands: [
356+
{
357+
id: 15
358+
},
359+
{
360+
id: 16
361+
}
362+
],
314363
images: [
315364
{
316365
src: "http://example.com/wp-content/uploads/2015/01/premium-quality-front.jpg",
@@ -391,6 +440,13 @@ woocommerce.post("products", data).parsed_response
391440
"T-shirts"
392441
],
393442
"tags": [],
443+
"brands": [
444+
{
445+
"id": 99,
446+
"name": "Test",
447+
"slug": "test"
448+
}
449+
],
394450
"images": [
395451
{
396452
"id": 547,
@@ -443,6 +499,14 @@ curl -X POST https://example.com/wc-api/v3/products \
443499
9,
444500
14
445501
],
502+
"brands": [
503+
{
504+
"id": 15
505+
},
506+
{
507+
"id": 16
508+
}
509+
],
446510
"images": [
447511
{
448512
"src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
@@ -530,6 +594,14 @@ var data = {
530594
9,
531595
14
532596
],
597+
brands: [
598+
{
599+
id: 15
600+
},
601+
{
602+
id: 16
603+
}
604+
],
533605
images: [
534606
{
535607
src: 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg',
@@ -622,6 +694,14 @@ $data = [
622694
9,
623695
14
624696
],
697+
'brands' => [
698+
[
699+
'id' => 15
700+
],
701+
[
702+
'id' => 16
703+
]
704+
],
625705
'images' => [
626706
[
627707
'src' => 'http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg',
@@ -712,6 +792,14 @@ data = {
712792
9,
713793
14
714794
],
795+
"brands": [
796+
{
797+
"id": 15
798+
},
799+
{
800+
"id": 16
801+
}
802+
],
715803
"images": [
716804
{
717805
"src": "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
@@ -801,6 +889,14 @@ data = {
801889
9,
802890
14
803891
],
892+
brands: [
893+
{
894+
id: 15
895+
},
896+
{
897+
id: 16
898+
}
899+
],
804900
images: [
805901
{
806902
src: "http://example.com/wp-content/uploads/2015/01/ship-your-idea-black-front.jpg",
@@ -943,6 +1039,13 @@ woocommerce.post("products", data).parsed_response
9431039
"T-shirts"
9441040
],
9451041
"tags": [],
1042+
"brands": [
1043+
{
1044+
"id": 99,
1045+
"name": "test",
1046+
"slug": "test"
1047+
}
1048+
],
9461049
"images": [
9471050
{
9481051
"id": 605,
@@ -1214,6 +1317,13 @@ woocommerce.get("products/546").parsed_response
12141317
"T-shirts"
12151318
],
12161319
"tags": [],
1320+
"brands": [
1321+
{
1322+
"id": 99,
1323+
"name": "test",
1324+
"slug": "test"
1325+
}
1326+
],
12171327
"images": [
12181328
{
12191329
"id": 547,
@@ -1763,6 +1873,13 @@ woocommerce.put("products/546", data).parsed_response
17631873
"T-shirts"
17641874
],
17651875
"tags": [],
1876+
"brands": [
1877+
{
1878+
"id": 99,
1879+
"name": "test",
1880+
"slug": "test"
1881+
}
1882+
],
17661883
"images": [
17671884
{
17681885
"id": 547,

0 commit comments

Comments
 (0)