I am trying to make an api call to get a list of products. I am using searchCriteria to filter the products collection. The following information of the product is needed:
-sku, name, id, price, status, visibility, type_id, qty, image-url, small-image-url
The following call gives all information, excluding qty:
{ "items": [ { "id": 1, "sku": "Test", "name": "Test 100x100", "attribute_set_id": 4, "price": 200, "status": 1, "visibility": 4, "type_id": "simple", "created_at": "2017-08-23 17:48:05", "updated_at": "2017-08-23 17:48:05", "weight": 1, "extension_attributes": [], "product_links": [], "tier_prices": [], "custom_attributes": [ { "attribute_code": "meta_title", "value": "Test" }, { "attribute_code": "meta_keyword", "value": "Test" }, { "attribute_code": "meta_description", "value": "Test " }, { "attribute_code": "image", "value": "/c/a/cat1.png" }, { "attribute_code": "small_image", "value": "/c/a/cat1.png" }, { "attribute_code": "thumbnail", "value": "/c/a/cat1.png" }, { "attribute_code": "options_container", "value": "container2" }, { "attribute_code": "required_options", "value": "0" }, { "attribute_code": "has_options", "value": "0" }, { "attribute_code": "url_key", "value": "test" }, { "attribute_code": "swatch_image", "value": "/c/a/cat1.png" }, { "attribute_code": "tax_class_id", "value": "2" }, { "attribute_code": "gift_message_available", "value": "2" }, { "attribute_code": "laenge_intern", "value": "100.0000" }, { "attribute_code": "breite_intern", "value": "100.0000" }, { "attribute_code": "sw_featured", "value": "0" } ] }, { "id": 2, "sku": "Test-1", "name": "Test 100x110", "attribute_set_id": 4, "price": 200, "status": 1, "visibility": 4, "type_id": "simple", "created_at": "2017-08-29 20:20:54", "updated_at": "2017-08-29 20:20:54", "weight": 1, "extension_attributes": [], "product_links": [], "tier_prices": [], "custom_attributes": [ { "attribute_code": "meta_title", "value": "Test" }, { "attribute_code": "meta_keyword", "value": "Test" }, { "attribute_code": "meta_description", "value": "Test " }, { "attribute_code": "image", "value": "/c/a/cat1_1.png" }, { "attribute_code": "small_image", "value": "/c/a/cat1_1.png" }, { "attribute_code": "thumbnail", "value": "/c/a/cat1_1.png" }, { "attribute_code": "options_container", "value": "container2" }, { "attribute_code": "required_options", "value": "0" }, { "attribute_code": "has_options", "value": "0" }, { "attribute_code": "url_key", "value": "test-1" }, { "attribute_code": "swatch_image", "value": "/c/a/cat1_1.png" }, { "attribute_code": "tax_class_id", "value": "2" }, { "attribute_code": "gift_message_available", "value": "2" }, { "attribute_code": "laenge_intern", "value": "100.0000" }, { "attribute_code": "breite_intern", "value": "110.0000" }, { "attribute_code": "sw_featured", "value": "0" } ] } ], "search_criteria": { "filter_groups": [ { "filters": [ { "field": "price", "value": "25", "condition_type": "from" }, { "field": "price", "value": "500", "condition_type": "to" } ] } ], "page_size": 2, "current_page": 1 }, "total_count": 6 } In the Doc Site http://devdocs.magento.com/guides/v2.1/howdoi/webapi/filter-response.html they mention the 'fields' parameter to get the items qty. I tried the following call, but it still does not include qty into the response:
As expected it returns items with id, sku, name. But no qty.
How to get item qty in the response ?
Thanks