Pim-community-dev: Being able to query product/models by their identifiers/codes via tha API

Created on 26 Aug 2020  ·  4Comments  ·  Source: akeneo/pim-community-dev

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?

Most helpful comment

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 :)

All 4 comments

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_

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.

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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulchubatyy picture paulchubatyy  ·  5Comments

lpxavi picture lpxavi  ·  4Comments

ronthedrummer picture ronthedrummer  ·  3Comments

pardahlman picture pardahlman  ·  4Comments

wakqasahmed picture wakqasahmed  ·  4Comments