magento2: Rest API missing “stock_item” in to the list of the products
Magento 2.3.0 rest API missing stock_item
in to the list of the products.
Preconditions (*)
- Magento 2.3.0
Steps to reproduce (*)
- Run product list API
- Method: GET
- URL: http://localhost/magentosample230/rest/V1/products?searchCriteria[pageSize]=10&searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=4&searchCriteria[filter_groups][0][filters][0][condition_type]=eq
Expected result (*)
stock_item
should be included in API response.
API Expected Response:
{
"items": [
{
"id": 1,
"sku": "24-MB01",
"name": "Joust Duffle Bag",
"attribute_set_id": 15,
"price": 34,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2019-08-30 07:14:51",
"updated_at": "2019-08-30 07:14:51",
"extension_attributes": {
"stock_item": {
"item_id": 1,
"product_id": 1,
"stock_id": 1,
"qty": 100,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 10000,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
},
"website_ids": [
1
],
"category_links": [
{
"position": 0,
"category_id": "3"
},
{
"position": 0,
"category_id": "4"
}
]
},
"product_links": [
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-WG086",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-WG083-blue",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-UG01",
"linked_product_type": "simple",
"position": 3
},
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-WG085_Group",
"linked_product_type": "grouped",
"position": 4
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB02",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB03",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB05",
"linked_product_type": "simple",
"position": 3
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB06",
"linked_product_type": "simple",
"position": 4
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-UB02",
"linked_product_type": "simple",
"position": 5
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-WB03",
"linked_product_type": "simple",
"position": 6
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-WB04",
"linked_product_type": "simple",
"position": 7
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-WB07",
"linked_product_type": "simple",
"position": 8
}
],
"options": [],
"media_gallery_entries": [
{
"id": 1,
"media_type": "image",
"label": "Image",
"position": 1,
"disabled": false,
"types": [
"image",
"small_image",
"thumbnail"
],
"file": "/m/b/mb01-blue-0.jpg"
}
],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "image",
"value": "/m/b/mb01-blue-0.jpg"
},
{
"attribute_code": "small_image",
"value": "/m/b/mb01-blue-0.jpg"
},
{
"attribute_code": "thumbnail",
"value": "/m/b/mb01-blue-0.jpg"
},
{
"attribute_code": "url_key",
"value": "joust-duffle-bag"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "category_ids",
"value": [
"3",
"4"
]
},
{
"attribute_code": "description",
"value": "<p>The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.<p>\n<ul>\n<li>Dual top handles.</li>\n<li>Adjustable shoulder strap.</li>\n<li>Full-length zipper.</li>\n<li>L 29\" x W 13\" x H 11\".</li>\n</ul>"
}
]
},
{
"id": 2,
"sku": "24-MB04",
"name": "Strive Shoulder Pack",
"attribute_set_id": 15,
"price": 32,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2019-08-30 07:14:52",
"updated_at": "2019-08-30 07:14:52",
"extension_attributes": {
"stock_item": {
"item_id": 2,
"product_id": 2,
"stock_id": 1,
"qty": 100,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 10000,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
},
"website_ids": [
1
],
"category_links": [
{
"position": 0,
"category_id": "3"
},
{
"position": 0,
"category_id": "7"
},
{
"position": 0,
"category_id": "4"
}
]
},
"product_links": [
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-UG03",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-UG05",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-WG080",
"linked_product_type": "bundle",
"position": 3
},
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-UG04",
"linked_product_type": "simple",
"position": 4
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB01",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB02",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB03",
"linked_product_type": "simple",
"position": 3
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB05",
"linked_product_type": "simple",
"position": 4
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB06",
"linked_product_type": "simple",
"position": 5
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-UB02",
"linked_product_type": "simple",
"position": 6
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB03",
"linked_product_type": "simple",
"position": 7
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB04",
"linked_product_type": "simple",
"position": 8
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB06",
"linked_product_type": "simple",
"position": 9
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB07",
"linked_product_type": "simple",
"position": 10
}
],
"options": [],
"media_gallery_entries": [
{
"id": 2,
"media_type": "image",
"label": "Image",
"position": 1,
"disabled": false,
"types": [
"image",
"small_image",
"thumbnail"
],
"file": "/m/b/mb04-black-0.jpg"
},
{
"id": 3,
"media_type": "image",
"label": "Image",
"position": 2,
"disabled": false,
"types": [],
"file": "/m/b/mb04-black-0_alt1.jpg"
}
],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "image",
"value": "/m/b/mb04-black-0.jpg"
},
{
"attribute_code": "small_image",
"value": "/m/b/mb04-black-0.jpg"
},
{
"attribute_code": "special_price",
"value": "32.0000"
},
{
"attribute_code": "thumbnail",
"value": "/m/b/mb04-black-0.jpg"
},
{
"attribute_code": "special_from_date",
"value": "2019-08-30 07:14:52"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "url_key",
"value": "strive-shoulder-pack"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "tax_class_id",
"value": "2"
},
{
"attribute_code": "category_ids",
"value": [
"3",
"7",
"4"
]
},
{
"attribute_code": "description",
"value": "<p>Convenience is next to nothing when your day is crammed with action. So whether you're heading to class, gym, or the unbeaten path, make sure you've got your Strive Shoulder Pack stuffed with all your essentials, and extras as well.</p>\n<ul>\n<li>Zippered main compartment.</li>\n<li>Front zippered pocket.</li>\n<li>Side mesh pocket.</li>\n<li>Cell phone pocket on strap.</li>\n<li>Adjustable shoulder strap and top carry handle.</li>\n</ul>"
},
{
"attribute_code": "activity",
"value": "11,21,23,18"
},
{
"attribute_code": "style_bags",
"value": "27,29,30"
},
{
"attribute_code": "material",
"value": "32,33,36,38"
},
{
"attribute_code": "strap_bags",
"value": "61,62,65,66,67"
},
{
"attribute_code": "features_bags",
"value": "72,74,75,78"
},
{
"attribute_code": "erin_recommends",
"value": "1"
},
{
"attribute_code": "sale",
"value": "1"
}
]
}
]
}
Actual result (*)
- Missing
stock_item
in the API response.
API Actual Response:
{
"items": [
{
"id": 1,
"sku": "24-MB01",
"name": "Joust Duffle Bag",
"attribute_set_id": 15,
"price": 34,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2019-08-30 07:14:51",
"updated_at": "2019-08-30 07:14:51",
"extension_attributes": {
"website_ids": [
1
],
"category_links": [
{
"position": 0,
"category_id": "3"
},
{
"position": 0,
"category_id": "4"
}
]
},
"product_links": [
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-WG086",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-WG083-blue",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-UG01",
"linked_product_type": "simple",
"position": 3
},
{
"sku": "24-MB01",
"link_type": "crosssell",
"linked_product_sku": "24-WG085_Group",
"linked_product_type": "grouped",
"position": 4
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB02",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB03",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB05",
"linked_product_type": "simple",
"position": 3
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-MB06",
"linked_product_type": "simple",
"position": 4
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-UB02",
"linked_product_type": "simple",
"position": 5
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-WB03",
"linked_product_type": "simple",
"position": 6
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-WB04",
"linked_product_type": "simple",
"position": 7
},
{
"sku": "24-MB01",
"link_type": "upsell",
"linked_product_sku": "24-WB07",
"linked_product_type": "simple",
"position": 8
}
],
"options": [],
"media_gallery_entries": [
{
"id": 1,
"media_type": "image",
"label": "Image",
"position": 1,
"disabled": false,
"types": [
"image",
"small_image",
"thumbnail"
],
"file": "/m/b/mb01-blue-0.jpg"
}
],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "image",
"value": "/m/b/mb01-blue-0.jpg"
},
{
"attribute_code": "small_image",
"value": "/m/b/mb01-blue-0.jpg"
},
{
"attribute_code": "thumbnail",
"value": "/m/b/mb01-blue-0.jpg"
},
{
"attribute_code": "url_key",
"value": "joust-duffle-bag"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "category_ids",
"value": [
"3",
"4"
]
},
{
"attribute_code": "description",
"value": "<p>The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.<p>\n<ul>\n<li>Dual top handles.</li>\n<li>Adjustable shoulder strap.</li>\n<li>Full-length zipper.</li>\n<li>L 29\" x W 13\" x H 11\".</li>\n</ul>"
}
]
},
{
"id": 2,
"sku": "24-MB04",
"name": "Strive Shoulder Pack",
"attribute_set_id": 15,
"price": 32,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2019-08-30 07:14:52",
"updated_at": "2019-08-30 07:14:52",
"extension_attributes": {
"website_ids": [
1
],
"category_links": [
{
"position": 0,
"category_id": "3"
},
{
"position": 0,
"category_id": "7"
},
{
"position": 0,
"category_id": "4"
}
]
},
"product_links": [
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-UG03",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-UG05",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-WG080",
"linked_product_type": "bundle",
"position": 3
},
{
"sku": "24-MB04",
"link_type": "crosssell",
"linked_product_sku": "24-UG04",
"linked_product_type": "simple",
"position": 4
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB01",
"linked_product_type": "simple",
"position": 1
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB02",
"linked_product_type": "simple",
"position": 2
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB03",
"linked_product_type": "simple",
"position": 3
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB05",
"linked_product_type": "simple",
"position": 4
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-MB06",
"linked_product_type": "simple",
"position": 5
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-UB02",
"linked_product_type": "simple",
"position": 6
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB03",
"linked_product_type": "simple",
"position": 7
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB04",
"linked_product_type": "simple",
"position": 8
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB06",
"linked_product_type": "simple",
"position": 9
},
{
"sku": "24-MB04",
"link_type": "upsell",
"linked_product_sku": "24-WB07",
"linked_product_type": "simple",
"position": 10
}
],
"options": [],
"media_gallery_entries": [
{
"id": 2,
"media_type": "image",
"label": "Image",
"position": 1,
"disabled": false,
"types": [
"image",
"small_image",
"thumbnail"
],
"file": "/m/b/mb04-black-0.jpg"
},
{
"id": 3,
"media_type": "image",
"label": "Image",
"position": 2,
"disabled": false,
"types": [],
"file": "/m/b/mb04-black-0_alt1.jpg"
}
],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "image",
"value": "/m/b/mb04-black-0.jpg"
},
{
"attribute_code": "small_image",
"value": "/m/b/mb04-black-0.jpg"
},
{
"attribute_code": "special_price",
"value": "32.0000"
},
{
"attribute_code": "thumbnail",
"value": "/m/b/mb04-black-0.jpg"
},
{
"attribute_code": "special_from_date",
"value": "2019-08-30 07:14:52"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "url_key",
"value": "strive-shoulder-pack"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "tax_class_id",
"value": "2"
},
{
"attribute_code": "category_ids",
"value": [
"3",
"7",
"4"
]
},
{
"attribute_code": "description",
"value": "<p>Convenience is next to nothing when your day is crammed with action. So whether you're heading to class, gym, or the unbeaten path, make sure you've got your Strive Shoulder Pack stuffed with all your essentials, and extras as well.</p>\n<ul>\n<li>Zippered main compartment.</li>\n<li>Front zippered pocket.</li>\n<li>Side mesh pocket.</li>\n<li>Cell phone pocket on strap.</li>\n<li>Adjustable shoulder strap and top carry handle.</li>\n</ul>"
},
{
"attribute_code": "activity",
"value": "11,21,23,18"
},
{
"attribute_code": "style_bags",
"value": "27,29,30"
},
{
"attribute_code": "material",
"value": "32,33,36,38"
},
{
"attribute_code": "strap_bags",
"value": "61,62,65,66,67"
},
{
"attribute_code": "features_bags",
"value": "72,74,75,78"
},
{
"attribute_code": "erin_recommends",
"value": "1"
},
{
"attribute_code": "sale",
"value": "1"
}
]
}
]
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (6 by maintainers)
Someone should probably update the REST API documentation to match the deprications.
I think this should probably be fixed, or at least made possible by adding an extra parameter in case.
#mm19br