Moltin Node SDK, Filtering Products by Category



I cannot seem to filter my products using the Moltin Node SDK
I would like to search products by Category, EG: Leather
i do not really want to be getting all products then filtering on my microservice.
Could someone give me an example of how i would do this?


@thomassmwatson Unfortunately it is not currently possible to filter products by relationship on V2 of the API. This is not a limitation of the SDK. The best way to achieve this would be to get the category in question, and include the related products in the payload.

With the category ID:


Or alternatively with the name/slug:

  eq: {
    slug: 'category-slug'

The response payload will include a top level included object with a products array.

  "data": {
     // Your category record
  "included": {
    "products": [
      // The related products

Filtering by relationships is functionality that will we introduce further down the product roadmap.

Hope this helps! :upside_down_face: