0

When I call /V1/products/:sku,It give response like:

    {
        "id": 12,
        "sku": "SL-LS",
        "name": "Long Sleeve",
        "attribute_set_id": 4,
        "price": 0,
        "status": 1,
        "visibility": 4,
        "type_id": "simple",
        "created_at": "2018-03-20 20:04:54",
        "updated_at": "2018-04-26 02:45:29",
        "weight": 33,
        "extension_attributes": [],
        "product_links": [],
        "tier_prices": [],
        "custom_attributes": [
            {
                "attribute_code": "description",
                "value": "<p>A Long wide sleeve that usually hangs loose from the shoulder. A long sleeve with a deep armhole, tapering towards the wrist. Also known as a \"magyar\" sleeve. A long sleeve fitted from the shoulder to elbow and gently flared from elbow onward.</p>"
            },
            {
                "attribute_code": "short_description",
                "value": "<p>A&nbsp;Long&nbsp; wide sleeve that usually hangs loose from the shoulder. A long sleeve with a deep armhole, tapering towards the wrist.</p>"
            },
            {
                "attribute_code": "meta_title",
                "value": "Long Sleeve"
            },
            {
                "attribute_code": "meta_keyword",
                "value": "Long Sleeve"
            },
            {
                "attribute_code": "meta_description",
                "value": "Long Sleeve A Long wide sleeve that usually hangs loose from the shoulder. A long sleeve with a deep armhole, tapering towards the wrist. Also known as a \"magyar\" sleeve. A long sleeve fitted from the shoulder to elbow and gently flared from elbow onward."
            },
            {
                "attribute_code": "image",
                "value": "no_selection"
            },
            {
                "attribute_code": "small_image",
                "value": "/f/o/fox-ministry-all-iconslong-sleeve.png"
            },
            {
                "attribute_code": "thumbnail",
                "value": "/f/o/fox-ministry-all-iconslong-sleeve.png"
            },
            {
                "attribute_code": "options_container",
                "value": "container2"
            },
            {
                "attribute_code": "required_options",
                "value": "0"
            },
            {
                "attribute_code": "has_options",
                "value": "0"
            },
            {
                "attribute_code": "url_key",
                "value": "long-sleeve"
            },
            {
                "attribute_code": "swatch_image",
                "value": "/f/u/full-sleeve_1.jpg"
            },
            {
                "attribute_code": "tax_class_id",
                "value": "2"
            },
            {
                "attribute_code": "gift_message_available",
                "value": "2"
            }
        ]
    }

I don't want some attributes like type_id,created_at,updated_at,weight,product_links,tier_price,meta_title,meta_keywords etc.How to get filter this attribute in api response?

  • You can simply ignore them. I can't see a reason to get rid of them. – PY Yick Jul 17 '18 at 5:50
  • When i used this api for mobile,unused data is showing in this api.I want ot some of the data in api. – Lovely Setia Jul 17 '18 at 5:52
  • which version of magento are you using? – user4536 Jul 9 at 4:37
0

Use Filtered search responses

You can append ?fields=,,... to any GET, POST, or PUT operation to filter unimportant information from the response.

On POST and PUT requests, Magento ignores the fields parameter as input, but the response includes only the requested fields and objects.

by appending

fields=<field1>,<field2>,etc

to your querystring, you can get exactly the fields that you want, even nested ones

This also helps reduce response size related errors and speeds up queries. Instead of returning fields that will just be ignored, try to return only the fields that you will use and add new ones as needed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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