Skip to content

Commit 0071b96

Browse files
authored
Merge pull request #212 from akeneo/revert_doc
Revert doc in 2.1 - must be added in master
2 parents 3927223 + 4c3e474 commit 0071b96

File tree

3 files changed

+6
-211
lines changed

3 files changed

+6
-211
lines changed

content/php-client/resources/product-entities/product-models.md

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -32,47 +32,14 @@ $productModel = $client->getProductModelApi()->get('rain_boots_red');
3232

3333
There are two ways of getting product models.
3434

35-
**Search builder**
36-
37-
::: warning
38-
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'])
51-
->addFilter('completeness', 'ALL COMPLETE', ['scope' => 'ecommerce'])
52-
->addFilter('categories', 'IN', 'winter_collection');
53-
54-
$searchFilters = $searchBuilder->getFilters();
55-
```
56-
5735
**By getting pages**
5836

59-
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.
6538

6639
```php
6740
$client = new \Akeneo\Pim\ApiClient\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
6841

69-
$searchBuilder = new \Akeneo\Pim\ApiClient\Search\SearchBuilder();
70-
$searchBuilder
71-
->addFilter('completeness', 'ALL COMPLETE', ['locale' => 'en_US', 'scope' => 'ecommerce']);
72-
$searchFilters = $searchBuilder->getFilters();
73-
74-
// get a cursor with a page size of 50, apply a search
75-
$products = $client->getProductModelApi()->all(50, ['search' => $searchFilters, 'scope' => 'ecommerce']);
42+
$firstPage = $client->getProductModelApi()->listPerPage(50, true);
7643
```
7744

7845
::: warning
@@ -88,23 +55,12 @@ You can get more information about this method [here](/php-client/list-resources
8855

8956
**With a cursor**
9057

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.
9759

9860
```php
9961
$client = new \Akeneo\Pim\ApiClient\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
10062

101-
$searchBuilder = new \Akeneo\Pim\ApiClient\Search\SearchBuilder();
102-
$searchBuilder
103-
->addFilter('completeness', 'ALL COMPLETE', ['locale' => 'en_US']);
104-
$searchFilters = $searchBuilder->getFilters();
105-
106-
// get a cursor with a page size of 50, apply a research
107-
$productModels = $client->getProductModelApi()->all(50, ['search' => $searchFilters, 'scope' => 'ecommerce']);
63+
$productModels = $client->getProductModelApi()->all(50);
10864
```
10965

11066
:::warning
@@ -113,8 +69,6 @@ There is a maximum limit allowed on server side for the parameter `pageSize`.
11369

11470
You can get more information about this method [here](/php-client/list-resources.html#with-a-cursor).
11571

116-
You can get more information about the available query parameters [here](/api-reference.html#get_product_models).
117-
11872
#### Create a product model
11973

12074
If the product model does not exist yet, this method creates it, otherwise it throws an exception.

content/rest-api/filter.md

Lines changed: 1 addition & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -160,148 +160,9 @@ 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-
## 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.
170-
171-
```
172-
/api/rest/v1/product-models?search={PRODUCT_MODEL_PROPERTY:[{"operator":OPERATOR,"value":VALUE}]}
173-
```
174-
175-
In the above url :
176-
- `PRODUCT_MODEL_PROPERTY` can be any property detailed in the sections below,
177-
- `OPERATOR` is an allowed operator for this `PRODUCT_MODEL_PROPERTY`,
178-
- `VALUE` is a value whose type corresponds to the allowed type detailed below.
179-
180-
#### Examples
181-
To only retrieve product models of the `winter_collection` category, you can use the following URL.
182-
183-
```
184-
/api/rest/v1/product-models?search={"categories":[{"operator":"IN","value":["winter_collection"]}]}
185-
```
186-
187-
Of course, you can combine as many filters as you want. The example below will get you the product models being 100% complete on the en_US locale.
188-
189-
```
190-
/api/rest/v1/product-models?search={"enabled":[{"operator":"IN","value":["winter_collection"}],"completeness":[{"operator":"ALL COMPLETE","locale":["en_US"]}]}
191-
```
192-
193-
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.
194-
195-
```
196-
/api/rest/v1/product-models?search={"created":[{"operator":"=","value":"2016-07-04"},{"operator":"=","value":"2016-07-05"}]}
197-
```
198-
199-
### On categories
200-
201-
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 |
205-
| ----------------- | -------------- | ------------------ |
206-
| `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.
215-
216-
```
217-
/api/rest/v1/product-models?search={"categories":[{"operator":"IN","value":["winter_collection"]}]}
218-
```
219-
220-
### On completeness
221-
222-
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 |
226-
| ----------------- | -------------- | ------------------ |
227-
| `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.
234-
235-
```
236-
/api/rest/v1/product-models?search={"completeness":[{"operator":"ALL COMPLETE","locale":"fr_FR","scope":"ecommerce"}]}
237-
```
238-
239-
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 |
251-
| ----------------- | -------------- | ------------------ |
252-
| `IN` | array of existing family | Only returns product models that are in the given family |
253-
| `NOT IN` | array of existing family | Only returns product models that are not in the given family |
254-
| `EMPTY` | no value | Only returns product models that have no family |
255-
| `NOT EMPTY` | no value | Only returns product models that have a family |
256-
257-
#### Examples
258-
To get the product models that are in the `camcorders` family, you can use the following URL.
259-
260-
```
261-
/api/rest/v1/product-models?search={"family":[{"operator":"IN","value":["camcorders"]}]}
262-
```
263-
264-
To get the product models that are not in the `camcorders` and `digital_cameras` family, you can use the following URL.
265-
266-
```
267-
/api/rest/v1/product-models?search={"family":[{"operator":"NOT IN","value":["camcorders","digital_cameras"]}]}
268-
```
269-
270-
### On creation or update date
271-
272-
To filter product models on creation or update date, use the product property `created` and `updated`, respectively.
273-
Here are the allowed operators to filter on these properties as well as the corresponding type of value expected in the `search` query parameter.
274-
275-
:::info
276-
Note that dates are interpreted in the time zone of the server that runs Akeneo PIM (e.g. date.timezone setting in php.ini).
277-
:::
278-
279-
| Operator | Allowed value type | Filter description |
280-
| ----------------- | -------------- | ------------------ |
281-
| `=` | 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.
291-
292-
```
293-
/api/rest/v1/product-models?search={"created":[{"operator":"=","value":"2016-07-04 10:00:00"}]}
294-
```
295-
296-
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-
302163

303164
## 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.
305166

306167
```
307168
/api/rest/v1/products?search={ATTIBUTE_CODE:[{"operator":OPERATOR,"value":VALUE,"locale":LOCALE_CODE,"scope":CHANNEL_CODE}]}

content/swagger/resources/product_models/routes/product_models.yaml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,7 @@ get:
77
- "2.0"
88
- "2.1"
99
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
30-
required: false
10+
parameters:
3111
- $ref: '#/parameters/pagination_type'
3212
- $ref: '#/parameters/page'
3313
- $ref: '#/parameters/search_after'

0 commit comments

Comments
 (0)