cancel
Showing results for 
Search instead for 
Did you mean: 

Details of the product is not shown when fetch all the product from REST API

Details of the product is not shown when fetch all the product from REST API

Hi sir,

When i tried to fetch all the products from REST API details of the field is not shown.
I had used this API  to get all product 
"http://localhost/magento2.1/rest/all/V1/products?searchCriteria[pageSize]=100&searchCriteria[currentPage]=1";
 
The Output of these URL is
"item" : {
        "id" : 13,
        "sku" : "play game",
        "name" : "play game",
        "attribute_set_id" : 4,
        "price" : 59,
        "status" : 1,
        "visibility" : 4,
        "type_id" : "simple",
        "created_at" : "2018-05-10 11:59:37",
        "updated_at" : "2018-05-10 11:59:37",
        "weight" : 3,
        "extension_attributes" : [ ],
        "product_links" : [ ],
        "tier_prices" : [ ],
        "custom_attributes" : [
            {
                "attribute_code" : "description",
                "value" : "<p>high quality chip ,rom:4gb.</p>"
            },
            {
                "attribute_code" : "meta_title",
                "value" : "play game"
            },
            {
                "attribute_code" : "meta_keyword",
                "value" : "play game"
            },
            {
                "attribute_code" : "meta_description",
                "value" : "play game high quality chip ,rom:4gb."
            },
            {
                "attribute_code" : "news_from_date",
                "value" : "2018-05-01 00:00:00"
            },
            {
                "attribute_code" : "news_to_date",
                "value" : "2018-05-31 00:00:00"
            },
            {
                "attribute_code" : "options_container",
                "value" : "container2"
            },
            {
                "attribute_code" : "required_options",
                "value" : "0"
            },
            {
                "attribute_code" : "has_options",
                "value" : "0"
            },
            {
                "attribute_code" : "country_of_manufacture",
                "value" : "JP"
            },
            {
                "attribute_code" : "url_key",
                "value" : "play-game"
            },
            {
                "attribute_code" : "tax_class_id",
                "value" : "2"
            },
            {
                "attribute_code" : "gift_message_available",
                "value" : "2"
            }
        ]
    },
Sir,i did not got the detail of this fields which is showing null as given below
"extension_attributes" : [ ],
"product_links" : [ ],
"tier_prices" : [ ],
How can i get all this field detail of bulk products fetch with single API call.
In this stock_item detail is not shown.
Please provide us how to get detail of this fields -
extension_attributes,product_links,tier_prices

Thanks
Ashish Kumar
8 REPLIES 8

Re: Details of the product is not shown when fetch all the product from REST API

Hello @ashish_kumar6

 

I don't know why you need all attribute on list page.

 

please check below issue:- https://github.com/magento/magento2/issues/2606

 

Hope it will help you.

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Details of the product is not shown when fetch all the product from REST API

Hi Sunil Patel,

 I need to save all the product detail in Data base, so i need the detail of all fields and also update the stock_item of all the product.

"extension_attribute":[ ]

"product_links":[ ]

"tier_prices":[ ]

this fields is showing null

how can i update the stock_item which is inside extension_attributes. 

Re: Details of the product is not shown when fetch all the product from REST API

Hi @ashish_kumar6

 

okay i understand your problem !

 

As you said you are getting blank in the below outputs :

 

 

extension_attribute:[ ]

product_links:[ ]

tier_prices:[ ]

 

 

Because in the backend your product doesn't have values for this !

 

so when create one product at backend and filled up all the details in it - then try to get that product using REST API - you will get all the details in it.

 

like you need to add Tier Pricing for that products , you need to set cross-sell/up-sells products for that - so create a product which covers all the values.

 

then get that product with rest api !!

 

you will get all the details ~!

 

hope it helps !

 

if issue solved,Click Kudos & Accept as Solution

Re: Details of the product is not shown when fetch all the product from REST API

Hello sir,

       I don't want to fetch single product detail in single API CALL or SKU.

I want to save all product fields detail with single API CALL.

Please provide us the procedure to save all product fields details with bulk product fetch using REST API.

I had used this URL in REST API-

"http://localhost/magento2.1/rest/V1/products?searchCriteria[pageSize]=100&searchCriteria[currentPage]=1"; 

 

Thanks 

Ashish Kumar

Re: Details of the product is not shown when fetch all the product from REST API

Hi @ashish_kumar6

 

As i mention !! by default it is not available in magento 2 !

 

you need to customize this api or you need to create your own api for the same

 

as of now its not available in Default Magento 2 so !!

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

Re: Details of the product is not shown when fetch all the product from REST API

Hello sir,

         You said that it's not available in magento2. 

Can i get in any other Magento series such as magento 2.1, 2.2, 2.

Also give the procedure to make custom api to get detail of the product.

Thanks

Ashish Kumar

Re: Details of the product is not shown when fetch all the product from REST API

Hi @ashish_kumar6

 

RE : Can i get in any other Magento series such as magento 2.1, 2.2, 2.

 

- Well API is common for all the versions - meaning it is not available in any version as of now , you can add it in feature request on the forums.

 

RE : Also give the procedure to make custom api to get detail of the product.

 

- i have already shared links how to create a custom api - you need to get product details in that programatically. Its broad topic so in your custom api - programatically you need to get product details !

 

Hope it helps 

if issue solved,Click Kudos & Accept as Solution

Re: Details of the product is not shown when fetch all the product from REST API

https://localhost/magento2.2/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=category_id& searchCriteria[filterGroups][0][filters][0][value]=47& searchCriteria[filterGroups][0][filters][0][conditionType]=eq

 

 

{
"items": [
{
"id": 2070,
"sku": "CASHEW-BB-WLOT-10K-BAG",
"name": "cashew bits 10 kilo packet",
"attribute_set_id": 4,
"price": 5000,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2018-12-18 12:33:04",
"updated_at": "2019-03-21 00:50:01",
"weight": 1,
"product_links": [],
"tier_prices": [
{
"customer_group_id": 32000,
"qty": 2,
"value": 8000,
"extension_attributes": {
"website_id": 0
}
},
{
"customer_group_id": 32000,
"qty": 3,
"value": 12000,
"extension_attributes": {
"website_id": 0
}
},
{
"customer_group_id": 32000,
"qty": 4,
"value": 18000,
"extension_attributes": {
"website_id": 0
}
}
],
"custom_attributes": [
{
"attribute_code": "description",
"value": "10kilo bulk bag"
},
{
"attribute_code": "image",
"value": "/c/a/cashe_4.jpg"
},
{
"attribute_code": "url_key",
"value": "w-lot-grade"
},
{
"attribute_code": "gift_message_available",
"value": "0"
},
{
"attribute_code": "tags",
"value": "w lot grade,baby cashew"
},
{
"attribute_code": "small_image",
"value": "/c/a/cashe_4.jpg"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "thumbnail",
"value": "/c/a/cashe_4.jpg"
},
{
"attribute_code": "min_qty",
"value": "0.5"
},
{
"attribute_code": "swatch_image",
"value": "/c/a/cashe_4.jpg"
},
{
"attribute_code": "max_qty",
"value": "10"
},
{
"attribute_code": "tax_class_id",
"value": "2"
},
{
"attribute_code": "increment_qty",
"value": "0.3"
},
{
"attribute_code": "quantity_and_stock_status",
"value": "1"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "show_countdown",
"value": "1"
},
{
"attribute_code": "category_ids",
"value": [
"42",
"47"
]
},
{
"attribute_code": "news_from_date",
"value": "2018-12-09 00:00:00"
},
{
"attribute_code": "news_to_date",
"value": "2018-12-31 00:00:00"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "featured",
"value": "0"
}
]
},

 

 

I am geting the same issue

stock_item : { }   is not displayed.  

 

but in this document , it is mentioned  https://devdocs.magento.com/swagger/#/

catalogProductRepositoryV1

 

{ "items": [ { "id": 0, "sku": "string", "name": "string", "attribute_set_id": 0, "price": 0, "status": 0, "visibility": 0, "type_id": "string", "created_at": "string", "updated_at": "string", "weight": 0, "extension_attributes": { "website_ids": [ 0 ], "category_links": [ { "position": 0, "category_id": "string", "extension_attributes": {} } ], "stock_item": { "item_id": 0, "product_id": 0, "stock_id": 0, "qty": 0, "is_in_stock": true, "is_qty_decimal": true, "show_default_notification_message": true, "use_config_min_qty": true, "min_qty": 0, "use_config_min_sale_qty": 0, "min_sale_qty": 0, "use_config_max_sale_qty": true, "max_sale_qty": 0, "use_config_backorders": true, "backorders": 0, "use_config_notify_stock_qty": true, "notify_stock_qty": 0, "use_config_qty_increments": true, "qty_increments": 0, "use_config_enable_qty_inc": true, "enable_qty_increments": true, "use_config_manage_stock": true, "manage_stock": true, "low_stock_date": "string", "is_decimal_divided": true, "stock_status_changed_auto": 0, "extension_attributes": {} }, "bundle_product_options": [ { "option_id": 0, "title": "string", "required": true, "type": "string", "position": 0, "sku": "string", "product_links": [ { "id": "string", "sku": "string", "option_id": 0, "qty": 0, "position": 0, "is_default": true, "price": 0, "price_type": 0, "can_change_quantity": 0, "extension_attributes": {} } ], "extension_attributes": {} } ], "configurable_product_options": [ { "id": 0, "attribute_id": "string", "label": "string", "position": 0, "is_use_default": true, "values": [ { "value_index": 0, "extension_attributes": {} } ], "extension_attributes": {}, "product_id": 0 } ], "configurable_product_links": [ 0 ], "downloadable_product_links": [ { "id": 0, "title": "string", "sort_order": 0, "is_shareable": 0, "price": 0, "number_of_downloads": 0, "link_type": "string", "link_file": "string", "link_file_content": { "file_data": "string", "name": "string", "extension_attributes": {} }, "link_url": "string", "sample_type": "string", "sample_file": "string", "sample_file_content": { "file_data": "string", "name": "string", "extension_attributes": {} }, "sample_url": "string", "extension_attributes": {} } ], "downloadable_product_samples": [ { "id": 0, "title": "string", "sort_order": 0, "sample_type": "string", "sample_file": "string", "sample_file_content": { "file_data": "string", "name": "string", "extension_attributes": {} }, "sample_url": "string", "extension_attributes": {} } ], "giftcard_amounts": [ { "attribute_id": 0, "website_id": 0, "value": 0, "website_value": 0, "extension_attributes": {} } ] }, "product_links": [ { "sku": "string", "link_type": "string", "linked_product_sku": "string", "linked_product_type": "string", "position": 0, "extension_attributes": { "qty": 0 } } ], "options": [ { "product_sku": "string", "option_id": 0, "title": "string", "type": "string", "sort_order": 0, "is_require": true, "price": 0, "price_type": "string", "sku": "string", "file_extension": "string", "max_characters": 0, "image_size_x": 0, "image_size_y": 0, "values": [ { "title": "string", "sort_order": 0, "price": 0, "price_type": "string", "sku": "string", "option_type_id": 0 } ], "extension_attributes": {} } ], "media_gallery_entries": [ { "id": 0, "media_type": "string", "label": "string", "position": 0, "disabled": true, "types": [ "string" ], "file": "string", "content": { "base64_encoded_data": "string", "type": "string", "name": "string" }, "extension_attributes": { "video_content": { "media_type": "string", "video_provider": "string", "video_url": "string", "video_title": "string", "video_description": "string", "video_metadata": "string" } } } ], "tier_prices": [ { "customer_group_id": 0, "qty": 0, "value": 0, "extension_attributes": { "percentage_value": 0, "website_id": 0 } } ], "custom_attributes": [ { "attribute_code": "string", "value": "string" } ] } ], "search_criteria": { "filter_groups": [ { "filters": [ { "field": "string", "value": "string", "condition_type": "string" } ] } ], "sort_orders": [ { "field": "string", "direction": "string" } ], "page_size": 0, "current_page": 0 }, "total_count": 0 }