4

I'm able to save a product with a POST request to my REST API endpoint. Now I would like to save manufacture attribute,too. I prepare this json structure

{
    "product": {
        "sku": "code",
        "name": "name",
        "price": 5,
        "attribute_set_id": 4,
        "status": 1,
        "visibility": 1,
        "extension_attributes": {
            "stock_item": {
                "qty": 0,
                "is_in_stock": false,
                "is_qty_decimal": false,
                "min_qty": "0",
                "qty_increments": "0"
            }
        },
        "custom_attributes": [{
            "attribute_code": "barcode",
            "value": "############"
        }, {
            "attribute_code": "family",
            "value": "product family"
        }, {
            "attribute_code": "description",
            "value": "product description"
        }, {
            "attribute_code": "category_ids",
            "value": ["1", "2", "41", "53", "87"]
        }, {
            "attribute_code": "manufacturer",
            "value": "213"
        }]
    }
}

This product is saved on my catalog but without manufacturer value, indeed the response about above request is

{
    "id": 2059,
    "sku": "code",
    "name": "name",
    "attribute_set_id": 4,
    "status": 1,
    "visibility": 1,
    "type_id": "simple",
    "created_at": "2019-06-17 08:02:23",
    "updated_at": "2019-06-17 08:02:23",
    "extension_attributes": {
        "website_ids": [1],
        "category_links": [{
            "position": 0,
            "category_id": "1"
        }, {
            "position": 0,
            "category_id": "2"
        }, {
            "position": 0,
            "category_id": "41"
        }, {
            "position": 0,
            "category_id": "53"
        }, {
            "position": 0,
            "category_id": "87"
        }]
    },
    "product_links": [],
    "options": [],
    "media_gallery_entries": [],
    "tier_prices": [],
    "custom_attributes": [{
        "attribute_code": "description",
        "value": "description"
    }, {
        "attribute_code": "url_key",
        "value": "name-of-product"
    }, {
        "attribute_code": "options_container",
        "value": "container2"
    }, {
        "attribute_code": "barcode",
        "value": "###########"
    }, {
        "attribute_code": "family",
        "value": "product family"
    }, {
        "attribute_code": "required_options",
        "value": "0"
    }, {
        "attribute_code": "has_options",
        "value": "0"
    }, {
        "attribute_code": "category_ids",
        "value": ["1", "2", "41", "53", "87"]
    }]
}

any suggestion?

Your Answer

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

Browse other questions tagged or ask your own question.