Skip to content

Commit 9e93a14

Browse files
author
Willy
committed
API-409: Add list product models via php client
1 parent 4e6df13 commit 9e93a14

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,45 @@ $client->getProductModelApi()->create('saddle_rain_boots', [
5959
```
6060

6161
Product model values use the same format as the product values. If you want to know more, take a look at [here](/documentation/resources.html#product-values).
62+
63+
### Get a list of product models
64+
65+
There are two ways of getting product models.
66+
67+
#### By getting pages
68+
69+
This method allows to get product models page per page, as a classical pagination.
70+
It's possible to get the total number of product models with this method.
71+
72+
```php
73+
$client = new \Akeneo\Pim\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
74+
75+
$firstPage = $client->getProductModelApi()->listPerPage(50, true);
76+
```
77+
78+
::: warning
79+
There is a maximum limit allowed on server side for the parameter `limit`.
80+
:::
81+
82+
::: warning
83+
Setting the parameter `with_count` to `true` can drastically decrease the performance.
84+
It's recommended to let this parameter with the default value `false` if the total number of product models is not needed in the response.
85+
:::
86+
87+
You can get more information about this method [here](/php-client/list-resources.html#by-getting-pages).
88+
89+
#### With a cursor
90+
91+
This method allows to iterate the product models. It will automatically get the next pages for you.
92+
93+
```php
94+
$client = new \Akeneo\Pim\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
95+
96+
$productModels = $client->getProductModelApi()->all(50);
97+
```
98+
99+
:::warning
100+
There is a maximum limit allowed on server side for the parameter `pageSize`.
101+
:::
102+
103+
You can get more information about this method [here](/php-client/list-resources.html#with-a-cursor).

0 commit comments

Comments
 (0)