Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Being able to query product/models by their identifiers/codes via tha API #12637

Closed
jjanvier opened this issue Aug 26, 2020 · 5 comments
Closed

Comments

@jjanvier
Copy link
Contributor

Asking for a friend :p

Hello Akeneo,

I hope you're all going well :)

I have a list of products and product models I'd like to retrieve from Akeneo API. I know only their code/identifier. And I can't get them directly via the GET /api/rest/v1/products or /api/rest/v1/product-models endpoints :(

Indeed those endpoints do not allow me to search on identifier or on code, which seems to be a base need. I have to use unitary endpoints (``/api/rest/v1/products/{identifier}`) instead, which will increase the load on the server.

Is this enhancement in the roadmap?

@jjanvier
Copy link
Contributor Author

FYI, I also opened a ticket here akeneo/api-php-client#188...

@pierrejolly
Copy link
Contributor

pierrejolly commented Aug 26, 2020

Hello Julien,

Currently you can filter by identifier like this : /api/rest/v1/products?search={"identifier":[{"operator":"IN","value":["1111111171", "13620748"]}]} same for product-models

https://api.akeneo.com/documentation/filter.html#filter-on-product-properties

@jjanvier
Copy link
Contributor Author

jjanvier commented Aug 26, 2020

Ah thanks.
On product models, the identifier property is called "code", not "identifier". So I tried

        $productModels = $this->apiClientFactory->getClient()->getProductModelApi()->all(
            50,
            ['search' => ['code' => [['operator' => 'IN', 'value' => $akeneoProductModelIds]]]]
        );

which doesn't work. It's a bit missleading.

@jjanvier
Copy link
Contributor Author

I think it would be good do explicitly list all the properties in https://api.akeneo.com/documentation/filter.html#filter-on-product-properties.

And same for product models.

Thanks for the help anyway :)

@timonburkard
Copy link

I agree, it is misleading. I tried filtering for 'code' first as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants