Can't filter product values on product/product models
jjanvier opened this issue · comments
I'd like to filter product values like explained in the API doc https://api.akeneo.com/documentation/filter.html#via-attributes.
Something like /api/rest/v1/products?attributes=id_sml
But when using the API client, it does not work :
$productModels = $this->apiClientFactory->getClient()->getProductModelApi()->all(
50,
[
'search' => ['updated' => [['operator' => '>', 'value' => $updatedAt->format('Y-m-d H:i:s')]]],
'attributes' => ['id_sml']
]
);
A ServerErrorHttpException
is launched, with the message Internal Server Error (see https://api.akeneo.com/php-client/exception.html#server-exception)
.
I guess it's not supported by the API client. Which is a bit sad. Is it planned on the roadmap?
Or maybe I'm doing something wrong.
Hi @jjanvier, the value of 'attributes' should be a comma-separated string instead of an array. E.g.:
$productModels = $api->getProductModelApi()->all(
50,
[
'search' => ['parent' => [['operator' => 'NOT EMPTY']]],
'attributes' => 'Mar_ShortDescription,Mar_LongDescription'
]
);
Hi @jjanvier
"Internal Server Error" means the problem is not on the PIM end, not the client. Feel free to open an issue on the PIM repository if you think it is still relevant, but hopefully it's been fixed in 2 years!
Closing.