When I do GET /rest/V1/products/prodID, in response (custom_attributes field) I have

     "attribute_code": "category_ids",
     "value": [

but if i do GET /rest/V1/products?searchCriteria, and get product list, "custom_attributes" don't have "attribute_code": "category_ids" what can i do for have "category_ids" in magento rest api response?

  • Is this a custom attribute? If so, you would probably have to go via the extension_attributes path to add it to the correct controller. See here as an example: atwix.com/development/…
    – tecjam
    Jan 24, 2019 at 16:20
  • If you mean the existing attribute you may just need to add it to the correct group in the catalog_attributes.xml via a custom module. <group name="catalog_product"><attribute name="category_ids" /></group>
    – tecjam
    Jan 24, 2019 at 16:26

1 Answer 1


The getList on Magento\Catalog\Model\ProductRepository which provides you GET /rest/V1/products?searchCriteria already supported your response with category_ids



You don't have to do anything from this, you'd just make sure products were belong to some categories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.