Skip to content

Commit 463b1b4

Browse files
authored
Merge pull request #268 from akeneo/TIP-1145
Get the variants of a given product model
2 parents 22e63e2 + a1723f7 commit 463b1b4

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

content/rest-api/filter.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can even combine several filters on the same product properties. The example
3737
/api/rest/v1/products?search={"created":[{"operator":"=","value":"2016-07-04 10:00:00"},{"operator":"=","value":"2016-07-05 10:00:00"}]}
3838
```
3939

40-
### On categories
40+
### On their categories
4141

4242
To filter products on their categories, use the property `categories`.
4343
Here are the allowed operators you can use to filter on the category code as well as the corresponding type of value expected in the `search` query parameter.
@@ -59,7 +59,7 @@ To get the products of the `winter_collection` category, you can use the followi
5959
```
6060

6161

62-
### On status
62+
### On their status
6363

6464
To filter products on their status, use the `enabled` property.
6565
Here are the allowed operators you can use to filter on the status as well as the corresponding type of value expected in the `search` query parameter.
@@ -76,7 +76,7 @@ To get the disabled products, you can use the following URL.
7676
/api/rest/v1/products?search={"enabled":[{"operator":"=","value":false}]}
7777
```
7878

79-
### On completeness
79+
### On their completeness
8080

8181
To filter products on their completeness, use the `completeness` product property. You will also need to provide a `scope` value to specify on which channel you want to filter with the completeness.
8282
Here are the allowed operators you can use to filter by completeness as well as the corresponding type of value expected in the `search` query parameter.
@@ -103,7 +103,7 @@ To get the products that are 100% complete on both the `en_US` and `fr_FR` local
103103
/api/rest/v1/products?search={"completeness":[{"operator":"GREATER OR EQUALS THAN ON ALL LOCALES","value":100,"locales":["en_US","fr_FR"],"scope":"ecommerce"}]}
104104
```
105105

106-
### On group or family
106+
### On their group or family
107107

108108
To filter products on groups or families, use respectively the product property `groups` and `family`.
109109
Here are the allowed operators you can use to filter on these properties as well as the corresponding type of value expected in the `search` query parameter.
@@ -128,7 +128,7 @@ To get the products that are not in the `camcorders` and `digital_cameras` famil
128128
/api/rest/v1/products?search={"family":[{"operator":"NOT IN","value":["camcorders","digital_cameras"]}]}
129129
```
130130

131-
### On creation or update date
131+
### On their creation or update date
132132

133133
To filter products on creation or update date, use respectively the product property `created` and `updated`.
134134
Here are the allowed operators to filter on these properties as well as the corresponding type of value expected in the `search` query parameter.
@@ -160,6 +160,25 @@ To get the products that were updated during the last 4 days, you can use the fo
160160
/api/rest/v1/products?search={"updated":[{"operator":"SINCE LAST N DAYS","value":4}]}
161161
```
162162

163+
164+
### On their parent
165+
166+
To get the variant products of a given product model, use the filter called `parent`.
167+
For now, this filter only accepts one operator: `=`. It expects a code of a product model, given as a string. This product model can be either a root product model or a sub product model.
168+
169+
#### Examples
170+
To get all the variant products of the root product model with the code `tshirt_armor`, you can use the following URL.
171+
172+
```
173+
/api/rest/v1/products?search={"parent":[{"operator":"=","value":"tshirt_armor"}]}
174+
```
175+
176+
To get all the variant products of the sub product model with the code `tshirt_armor_blue`, you can use the following URL.
177+
178+
```
179+
/api/rest/v1/products?search={"parent":[{"operator":"=","value":"tshirt_armor_blue"}]}
180+
```
181+
163182
## Filter on product model properties
164183

165184
::: warning

0 commit comments

Comments
 (0)