You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This feature is only available since the version 2.0 of the PHP API client.
39
-
Also it was added in the 2.3 version of the PIM and is therefore not present in previous versions.
40
-
:::
41
-
42
-
You can search over the product models, thanks to a list of filters.
43
-
A helper has been added to ease the construction of these filters.
44
-
45
-
For more information about the available filters and operators that you can use to search a list of product models, please refer to [this page](/documentation/filter.html).
46
-
47
-
```php
48
-
$searchBuilder = new \Akeneo\Pim\ApiClient\Search\SearchBuilder();
49
-
$searchBuilder
50
-
->addFilter('completeness', 'AT LEAST COMPLETE', ['locale' => 'en_US'])
This method allows you to get product models page per page, as a classical pagination.
60
-
It's possible to get the total number of product models with this method.
61
-
62
-
As for the paginated method, since the 2.3 version of the Akeneo PIM, the search builder can be used and all query parameters are available, except `with_count`.
63
-
64
-
For example, we only return product values belonging to the channel "ecommerce" by adding the query parameter `'scope' => 'ecommerce'`.
37
+
This method allows to get product models page per page, as a classical pagination.
65
38
66
39
```php
67
40
$client = new \Akeneo\Pim\ApiClient\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
68
41
69
-
$searchBuilder = new \Akeneo\Pim\ApiClient\Search\SearchBuilder();
@@ -88,23 +55,12 @@ You can get more information about this method [here](/php-client/list-resources
88
55
89
56
**With a cursor**
90
57
91
-
This method allows you to iterate the product models. It will automatically get the next pages for you.
92
-
With this method, it's not possible to get the previous page, or get the total number of product models.
93
-
94
-
As for the paginated method, since the 2.3 version of the Akeneo PIM, the search builder can be used and all query parameters are available, except `with_count`.
95
-
96
-
For example, in this example, we only return product values belonging to the channel "ecommerce" by adding the query parameter `'scope' => 'ecommerce'`.
58
+
This method allows to iterate the product models. It will automatically get the next pages for you.
97
59
98
60
```php
99
61
$client = new \Akeneo\Pim\ApiClient\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
100
62
101
-
$searchBuilder = new \Akeneo\Pim\ApiClient\Search\SearchBuilder();
Copy file name to clipboardExpand all lines: content/rest-api/filter.md
+1-140Lines changed: 1 addition & 140 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -160,148 +160,9 @@ To get the products that were updated during the last 4 days, you can use the fo
160
160
/api/rest/v1/products?search={"updated":[{"operator":"SINCE LAST N DAYS","value":4}]}
161
161
```
162
162
163
-
## Filter on product model properties
164
-
165
-
::: warning
166
-
This feature is available since the 2.3 version of the PIM.
167
-
:::
168
-
169
-
To filter product models by one of their properties, you can use the `search` query parameter. The value given to this query parameter should be a valid JSON as shown below.
You can even combine several filters on the same product model properties. The example below will get you the product models created both the 4th and the 5th of July 2016.
To filter product models on their categories, use the property `categories`.
202
-
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.
203
-
204
-
| Operator | Allowed value type | Filter description |
|`IN`| an array of existing category codes | Only returns the product models that are in the given categories |
207
-
|`NOT IN`| an array of existing category codes | Only returns the product models that are not in the given categories |
208
-
|`IN OR UNCLASSIFIED`| an array of existing category codes | Only returns the product models that are in the given categories or that are not classified in any categories |
209
-
|`IN CHILDREN`| an array of existing category codes | Only returns the product models that are in the children of the given categories |
210
-
|`NOT IN CHILDREN`| an array of existing category codes | Only returns the product models that are not in the children of the given categories |
211
-
|`UNCLASSIFIED`| no value | Only returns the product models that are not classified into any category |
212
-
213
-
#### Example
214
-
To get the product models of the `winter_collection` category, you can use the following URL.
To filter product models 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.
223
-
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.
224
-
225
-
| Operator | Allowed value type | Filter description |
|`AT LEAST COMPLETE`| no value | Only returns product models that have `at least one variant product` fully complete on the given channel for the given set of locales |
228
-
|`AT LEAST INCOMPLETE`| no value | Only returns product models that have `at least one variant product` incomplete on the given channel for the given set of locales |
229
-
|`ALL COMPLETE`| no value | Only returns product models that have all his variant products fully complete on the given channel for the given set of locales |
230
-
|`ALL INCOMPLETE`| no value | Only returns product models that have all his variant products incomplete on the given channel for the given set of locales |
231
-
232
-
#### Examples
233
-
To get the product models that are 100% complete for the `ecommerce` channel on `fr_FR` locale, you can use the following URL.
To get the product models that have at least one variant product 100% complete on both the `en_US` and `fr_FR` locales for the `ecommerce` channel, you can use the following URL.
240
-
241
-
```
242
-
/api/rest/v1/product-models?search={"completeness":[{"operator":"AT LEAST COMPLETE","locales":["en_US","fr_FR"],"scope":"ecommerce"}]}
243
-
```
244
-
245
-
### On family
246
-
247
-
To filter product models on families, use the product model property `family`.
248
-
Here are the allowed operators you can use to filter on this property as well as the corresponding type of value expected in the `search` query parameter.
249
-
250
-
| Operator | Allowed value type | Filter description |
|`=`| datetime <br> _Format: YYYY-MM-DD hh:mm:ss_| Only returns product models that were respectively<br> updated or created during the given day |
282
-
|`!=`| datetime <br> _Format: YYYY-MM-DD hh:mm:ss_| Only returns product models that were respectively<br> not updated or not created during the given day |
283
-
|`<`| datetime <br> _Format: YYYY-MM-DD hh:mm:ss_| Only returns product models that were respectively<br> updated or created before the given day |
284
-
|`>`| datetime <br> _Format: YYYY-MM-DD hh:mm:ss_| Only returns product models that were respectively<br> updated or created after the given day |
285
-
|`BETWEEN`| array of datetimes <br> _Format: YYYY-MM-DD hh:mm:ss_| Only returns product models that were respectively<br> updated or created between the two given dates |
286
-
|`NOT BETWEEN`| array of datetimes <br> _Format: YYYY-MM-DD hh:mm:ss_| Only returns product models that were respectively<br> not updated or not created between the two given dates |
287
-
|`SINCE LAST N DAYS`| integer | Only returns product models that were respectively updated<br> or created during the last n days, n being the given value |
288
-
|
289
-
#### Examples
290
-
To get the product models that were created on the 4th of July 2016 at 10am, you can use the following URL.
To get the product models that were updated during the last 4 days, you can use the following URL.
297
-
298
-
```
299
-
/api/rest/v1/product-models?search={"updated":[{"operator":"SINCE LAST N DAYS","value":4}]}
300
-
```
301
-
302
163
303
164
## Filter on product values
304
-
To filter products, and product models since the v2.3, on its [product values](/documentation/resources.html#product-values), you can use the `search` query parameter when requesting products. The value given to this query parameter should be a valid JSON as shown below.
165
+
To filter products on its [product values](/documentation/resources.html#product-values), you can use the `search` query parameter when requesting products. The value given to this query parameter should be a valid JSON as shown below.
Copy file name to clipboardExpand all lines: content/swagger/resources/product_models/routes/product_models.yaml
+1-21Lines changed: 1 addition & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -7,27 +7,7 @@ get:
7
7
- "2.0"
8
8
- "2.1"
9
9
description: This endpoint allows you to get a list of product models. Product models are paginated.
10
-
parameters:
11
-
- name: search
12
-
in: query
13
-
description: Filter product models, for more details see the <a href="/documentation/filter.html">Filters</a> section
14
-
required: false
15
-
type: string
16
-
- name: scope
17
-
in: query
18
-
type: string
19
-
description: Filter product values to return scopable attributes for the given channel as well as the non localizable/non scopable attributes, for more details see the <a href="/documentation/filter.html#filter-product-values">Filter on product values</a> section
20
-
required: false
21
-
- name: locales
22
-
in: query
23
-
type: string
24
-
description: Filter product values to return localizable attributes for the given locales as well as the non localizable/non scopable attributes, for more details see the <a href="/documentation/filter.html#filter-product-values">Filter on product values</a> section
25
-
required: false
26
-
- name: attributes
27
-
in: query
28
-
type: string
29
-
description: Filter product values to only return those concerning the given attributes, for more details see the <a href="/documentation/filter.html#filter-product-values">Filter on product values</a> section
0 commit comments