Invalid Object with Id Missing Item Option Value

Hi Guys,

I am trying to create a product with variants.

Here is my request in json format:

{
    "idempotency_key": "add-item-64e502a1bb762",
    "batches": [
        {
            "objects": [
                {
                    "0": {
                        "id": "#item_option_color",
                        "type": "ITEM_OPTION",
                        "item_option_data": {
                            "name": "COLOR_OPTIONS",
                            "values": [
                                {
                                    "id": "#item_option_value_color_rose_gold",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "ROSE GOLD"
                                    }
                                },
                                {
                                    "id": "#item_option_value_color_gold",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "GOLD"
                                    }
                                },
                                {
                                    "id": "#item_option_value_color_silver",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "SILVER"
                                    }
                                },
                                {
                                    "id": "#item_option_value_color_dark_blue",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "DARK BLUE"
                                    }
                                },
                                {
                                    "id": "#item_option_value_color_sky_blue",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "SKY BLUE"
                                    }
                                },
                                {
                                    "id": "#item_option_value_color_black",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "BLACK"
                                    }
                                }
                            ]
                        }
                    },
                    "1": {
                        "id": "#item_option_samsungmodels",
                        "type": "ITEM_OPTION",
                        "item_option_data": {
                            "name": "SAMSUNGMODELS_OPTIONS",
                            "values": [
                                {
                                    "id": "#item_option_value_samsungmodels_a6_2018",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "A6 2018"
                                    }
                                },
                                {
                                    "id": "#item_option_value_samsungmodels_a6_plus_2018",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "A6 PLUS 2018"
                                    }
                                },
                                {
                                    "id": "#item_option_value_samsungmodels_a7_2018",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "A7 2018"
                                    }
                                },
                                {
                                    "id": "#item_option_value_samsungmodels_a9_2018",
                                    "type": "ITEM_OPTION_VAL",
                                    "item_option_value_data": {
                                        "name": "A9 2018"
                                    }
                                }
                            ]
                        }
                    },
                    "id": "#item",
                    "type": "ITEM",
                    "item_data": {
                        "name": "Bakeey Smart Sleep Mirror Window View Bracket Protective Case For Samsung Galaxy A6 2018\/A6 Plus 2018\/A7 2018\/A9 2018",
                        "description_html": "<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" height=\"181\" style=\"width: 700px\" width=\"600\"><tbody><tr><td><span style=\"font-size: 14px;\">\u00a0Compatibility\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/td><td><span style=\"font-size: 14px;\">\u00a0 For Samsung\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><\/td><\/tr><tr><td><span style=\"font-size: 14px;\">\u00a0Compatible Model<\/span><\/td><td><span style=\"font-size: 14px;\">\u00a0 Galaxy A6 2018, Galaxy A6\u00a0Plus 2018, Galaxy A7 2018, Galaxy A9 2018<\/span><\/td><\/tr><tr><td><span style=\"font-size: 14px;\">\u00a0Material<\/span><\/td><td><span style=\"font-size: 14px;\">\u00a0 PU Leather+PP<\/span><\/td><\/tr><tr><td><span style=\"font-size: 14px;\">\u00a0Feature<\/span><\/td><td><span style=\"font-size: 14px;\">\u00a0 Smart Sleep, Smart View, Bracket, Mirror, Magnetic Flip<\/span><\/td><\/tr><tr><td><span style=\"font-size: 14px;\">\u00a0Type<\/span><\/td><td><span style=\"font-size: 14px;\">\u00a0 Full Body<\/span><\/td><\/tr><tr><td><span style=\"font-size: 14px;\">\u00a0Pattern<\/span><\/td><td><span style=\"font-size: 14px;\">\u00a0 Solid Color<\/span><\/td><\/tr><tr><td><span style=\"font-size: 14px;\">\u00a0Color<\/span><\/td><td><span style=\"font-size: 14px;\">\u00a0 Black, Sky Blue, Dark Blue, Gold, Silver, Rose Gold<\/span><\/td><\/tr><\/tbody><\/table><span style=\"font-size: 14px;\"><strong><span style=\"color: rgb(255, 0, 0);\">Note:\u00a0<\/span><\/strong><span style=\"color: rgb(178, 34, 34);\">1. Smart sleep function is supported via App which you need to scan the QR code on the back of the package to download.2. Sliding on the fron cover to answear incoming call is not supported.<\/span><\/span><div id=\"imgBox\"><\/div>",
                        "product_type": "REGULAR",
                        "item_options": [
                            {
                                "item_option_id": "#item_option_color"
                            },
                            {
                                "item_option_id": "#item_option_samsungmodels"
                            }
                        ],
                        "variations": [
                            {
                                "id": "#item_variation_color_rose_goldsamsungmodels_a6_2018",
                                "type": "ITEM_VARIATION",
                                "item_variation_data": {
                                    "item_option_values": [
                                        {
                                            "item_option_id": "#item_option_color",
                                            "item_option_value_id": "#item_option_value_color_rose_gold"
                                        },
                                        {
                                            "item_option_id": "#item_option_samsungmodels",
                                            "item_option_value_id": "#item_option_value_samsungmodels_a6_2018"
                                        }
                                    ],
                                    "price_money": {
                                        "amount": 660,
                                        "currency": "USD"
                                    },
                                    "pricing_type": "FIXED_PRICING"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

But I am getting error -
{
“errors”: [
{
“category”: “INVALID_REQUEST_ERROR”,
“code”: “INVALID_VALUE”,
“detail”: “Invalid object: Invalid Object with Id: #item_variation_color_rose_goldsamsungmodels_a6_2018\n[merchant_token=ML6A974FB12SS] Missing Item Option Value "#item_option_value_color_rose_gold".”
}
]
}

I will appreciate any help on this.

It seems like there’s an issue with your request. The error suggests that there’s an invalid object with the ID “#item_variation_color_rose_goldsamsungmodels_a6_2018,” and it’s missing the item option value “#item_option_value_color_rose_gold.” Double-check the structure of your JSON request to ensure that the item option values are correctly associated with the variations. It appears that there might be a mismatch or a missing link between the item option values and the variations. Review the JSON structure carefully, ensuring that all IDs and associations are accurate and properly nested. This should help resolve the “Invalid Object with Id” error you’re encountering.