• 0
Sign in to follow this  
PedroReichert

Erro nos atributos ao inserir produto com variações

Question

Olá caros amigos,

Estou tentando inserir o seguinte JSON:
 

<pre>
	Array
(
    [title] => produto de teste de id 89
    [category_id] => MLB270416
    [price] => 8.94
    [available_quantity] => 2
    [description] => Array
        (
            [plain_text] => required
        )

    [pictures] => Array
        (
            [0] => Array
                (
                    [source] => https://camisariacolombov2.vteximg.com.br/arquivos/ids/372480-480-524/http---ecommerce.adezan.com.br-11700990003-11700990003_2.jpg?v=636361798262970000
                )

            [1] => Array
                (
                    [source] => https://todateen.com.br/wp-content/uploads/2019/05/Captura-de-Tela-2019-05-24-a%CC%80s-14.04.59.jpg
                )

            [2] => Array
                (
                    [source] => https://img.quizur.com/f/img5d7edfcad90e41.36599685.jpg
                )

        )

    [attributes] => Array
        (
            [0] => Array
                (
                    [id] => COLOR
                    [name] => Cor
                    [value_id] => 283165
                    [value_name] => Cinza
                )

            [1] => Array
                (
                    [id] => BRAND
                    [name] => Marca
                    [value_id] => -1
                    [value_name] => 
                )

            [2] => Array
                (
                    [id] => MODEL
                    [name] => Modelo
                    [value_id] => -1
                    [value_name] => 
                )

            [3] => Array
                (
                    [id] => BOARD_LENGTH
                    [name] => Comprimento da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [4] => Array
                (
                    [id] => BOARD_WIDTH
                    [name] => Largura da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [5] => Array
                (
                    [id] => BOARD_MATERIAL
                    [name] => Material da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [6] => Array
                (
                    [id] => POSITIONS_NUMBER
                    [name] => Quantidade de posições
                    [value_id] => -1
                    [value_name] => 
                )

            [7] => Array
                (
                    [id] => WITH_TABLE
                    [name] => Com mesa
                    [value_id] => -1
                    [value_name] => 
                )

            [8] => Array
                (
                    [id] => ACCESSORIES_INCLUDED
                    [name] => Acessórios incluídos
                    [value_id] => -1
                    [value_name] => 
                )

            [9] => Array
                (
                    [id] => GTIN
                    [name] => Código universal de produto
                    [value_id] => -1
                    [value_name] => 
                )

            [10] => Array
                (
                    [id] => BOARD_THICKNESS
                    [name] => Espessura da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [11] => Array
                (
                    [id] => MAX_TILT_ANGLE
                    [name] => Ângulo máximo de inclinação
                    [value_id] => -1
                    [value_name] => 
                )

            [12] => Array
                (
                    [id] => WITH_ADJUSTABLE_HEIGHT
                    [name] => Com altura ajustável
                    [value_id] => -1
                    [value_name] => 
                )

            [13] => Array
                (
                    [id] => BASE_MATERIAL
                    [name] => Material da base
                    [value_id] => -1
                    [value_name] => 
                )

            [14] => Array
                (
                    [id] => EAN
                    [name] => EAN
                    [value_id] => -1
                    [value_name] => 
                )

            [15] => Array
                (
                    [id] => UPC
                    [name] => UPC
                    [value_id] => -1
                    [value_name] => 
                )

            [16] => Array
                (
                    [id] => MPN
                    [name] => MPN
                    [value_id] => -1
                    [value_name] => 
                )

            [17] => Array
                (
                    [id] => SELLER_SKU
                    [name] => SKU
                    [value_id] => -1
                    [value_name] => 
                )

            [18] => Array
                (
                    [id] => IS_FLAMMABLE
                    [name] => É inflamável
                    [value_id] => -1
                    [value_name] => 
                )

            [19] => Array
                (
                    [id] => IS_KIT
                    [name] => É kit
                    [value_id] => -1
                    [value_name] => 
                )

            [20] => Array
                (
                    [id] => PRODUCT_FEATURES
                    [name] => Características do produto
                    [value_id] => -1
                    [value_name] => 
                )

            [21] => Array
                (
                    [id] => PRODUCT_CHEMICAL_FEATURES
                    [name] => Características químicas do produto
                    [value_id] => -1
                    [value_name] => 
                )

            [22] => Array
                (
                    [id] => FOODS_AND_DRINKS
                    [name] => Alimentos e bebidas
                    [value_id] => -1
                    [value_name] => 
                )

            [23] => Array
                (
                    [id] => MEDICINES
                    [name] => Medicamentos
                    [value_id] => -1
                    [value_name] => 
                )

            [24] => Array
                (
                    [id] => BATTERIES_FEATURES
                    [name] => Características das baterias
                    [value_id] => -1
                    [value_name] => 
                )

            [25] => Array
                (
                    [id] => SHIPMENT_PACKING
                    [name] => Embalagem do envío
                    [value_id] => -1
                    [value_name] => 
                )

            [26] => Array
                (
                    [id] => ADDITIONAL_INFO_REQUIRED
                    [name] => Informação adicional requerida
                    [value_id] => -1
                    [value_name] => 
                )

            [27] => Array
                (
                    [id] => JAN
                    [name] => JAN
                    [value_id] => -1
                    [value_name] => 
                )

            [28] => Array
                (
                    [id] => GTIN14
                    [name] => GTIN-14
                    [value_id] => -1
                    [value_name] => 
                )

        )

    [variations] => Array
        (
            [0] => Array
                (
                    [id] => 
                    [attribute_combinations] => Array
                        (
                            [0] => Array
                                (
                                    [id] => COLOR
                                    [name] => Cor
                                    [value_id] => 52019
                                    [value_name] => Verde-escuro
                                )

                        )

                    [price] => 8.94
                    [available_quantity] => 2
                    [seller_custom_field] => 99V5
                    [sold_quantity] => 0
                    [picture_ids] => Array
                        (
                            [0] => https://img.quizur.com/f/img5d7edfcad90e41.36599685.jpg
                        )

                )

        )

    [status] => active
    [currency_id] => BRL
    [buying_mode] => buy_it_now
    [listing_type_id] => gold_special
    [condition] => new
    [video_id] => 
    [warranty] => 30
    [site_id] => MLB
    [shipping] => Array
        (
            [mode] => me2
            [local_pick_up] => 
            [free_shipping] => 
            [free_methods] => Array
                (
                )

        )

)
</pre>

 

 

 

Porém, recebo a seguinte resposta:

 

<pre>
Array
(
    [body] => stdClass Object
        (
            [message] => Validation error
            [error] => validation_error
            [status] => 400
            [cause] => Array
                (
                    [0] => stdClass Object
                        (
                            [department] => structured-data
                            [cause_id] => 1210
                            [type] => warning
                            [code] => normalize.item.attribute.value_id
                            [references] => Array
                                (
                                    [0] => item.variations[0].attribute_combinations[0].value_id
                                )

                            [message] => Attribute [COLOR] to be modified - value_id [52019] will be [null]
                        )

                    [1] => stdClass Object
                        (
                            [department] => items
                            [cause_id] => 146
                            [type] => error
                            [code] => item.attributes.invalid
                            [references] => Array
                                (
                                    [0] => item.attributes
                                    [1] => item.variations.attribute_combinations
                                    [2] => item.variations.attributes
                                )

                            [message] => Same attributes are used in more than of item.attributes, variation.attribute_combinations and variation.attributes
                        )

                    [2] => stdClass Object
                        (
                            [department] => structured-data
                            [cause_id] => 1210
                            [type] => warning
                            [code] => normalize.item.attribute.value_id
                            [references] => Array
                                (
                                    [0] => item.attributes[0].value_id
                                )

                            [message] => Attribute [COLOR] to be modified - value_id [283165] will be [null]
                        )

                )

        )

    [httpCode] => 400
)

</pre>

 

 

Reparem, que os ids das cores são diferentes, mas parece que a API não reconhece nenhum deles. Eu já tentei mandar somente o  <i>value_name</i> porem sem sucesso.
Pelo que vi na documentação, minha sintaxe está aparentemente correta...
Enfim, esgotei minhas ideias e por isso venho até vós.

Grato desde já.

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 1
14 hours ago, PedroReichert said:

Olá caros amigos,

Estou tentando inserir o seguinte JSON:
 


<pre>
	Array
(
    [title] => produto de teste de id 89
    [category_id] => MLB270416
    [price] => 8.94
    [available_quantity] => 2
    [description] => Array
        (
            [plain_text] => required
        )

    [pictures] => Array
        (
            [0] => Array
                (
                    [source] => https://camisariacolombov2.vteximg.com.br/arquivos/ids/372480-480-524/http---ecommerce.adezan.com.br-11700990003-11700990003_2.jpg?v=636361798262970000
                )

            [1] => Array
                (
                    [source] => https://todateen.com.br/wp-content/uploads/2019/05/Captura-de-Tela-2019-05-24-a%CC%80s-14.04.59.jpg
                )

            [2] => Array
                (
                    [source] => https://img.quizur.com/f/img5d7edfcad90e41.36599685.jpg
                )

        )

    [attributes] => Array
        (
            [0] => Array
                (
                    [id] => COLOR
                    [name] => Cor
                    [value_id] => 283165
                    [value_name] => Cinza
                )

            [1] => Array
                (
                    [id] => BRAND
                    [name] => Marca
                    [value_id] => -1
                    [value_name] => 
                )

            [2] => Array
                (
                    [id] => MODEL
                    [name] => Modelo
                    [value_id] => -1
                    [value_name] => 
                )

            [3] => Array
                (
                    [id] => BOARD_LENGTH
                    [name] => Comprimento da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [4] => Array
                (
                    [id] => BOARD_WIDTH
                    [name] => Largura da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [5] => Array
                (
                    [id] => BOARD_MATERIAL
                    [name] => Material da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [6] => Array
                (
                    [id] => POSITIONS_NUMBER
                    [name] => Quantidade de posições
                    [value_id] => -1
                    [value_name] => 
                )

            [7] => Array
                (
                    [id] => WITH_TABLE
                    [name] => Com mesa
                    [value_id] => -1
                    [value_name] => 
                )

            [8] => Array
                (
                    [id] => ACCESSORIES_INCLUDED
                    [name] => Acessórios incluídos
                    [value_id] => -1
                    [value_name] => 
                )

            [9] => Array
                (
                    [id] => GTIN
                    [name] => Código universal de produto
                    [value_id] => -1
                    [value_name] => 
                )

            [10] => Array
                (
                    [id] => BOARD_THICKNESS
                    [name] => Espessura da prancheta
                    [value_id] => -1
                    [value_name] => 
                )

            [11] => Array
                (
                    [id] => MAX_TILT_ANGLE
                    [name] => Ângulo máximo de inclinação
                    [value_id] => -1
                    [value_name] => 
                )

            [12] => Array
                (
                    [id] => WITH_ADJUSTABLE_HEIGHT
                    [name] => Com altura ajustável
                    [value_id] => -1
                    [value_name] => 
                )

            [13] => Array
                (
                    [id] => BASE_MATERIAL
                    [name] => Material da base
                    [value_id] => -1
                    [value_name] => 
                )

            [14] => Array
                (
                    [id] => EAN
                    [name] => EAN
                    [value_id] => -1
                    [value_name] => 
                )

            [15] => Array
                (
                    [id] => UPC
                    [name] => UPC
                    [value_id] => -1
                    [value_name] => 
                )

            [16] => Array
                (
                    [id] => MPN
                    [name] => MPN
                    [value_id] => -1
                    [value_name] => 
                )

            [17] => Array
                (
                    [id] => SELLER_SKU
                    [name] => SKU
                    [value_id] => -1
                    [value_name] => 
                )

            [18] => Array
                (
                    [id] => IS_FLAMMABLE
                    [name] => É inflamável
                    [value_id] => -1
                    [value_name] => 
                )

            [19] => Array
                (
                    [id] => IS_KIT
                    [name] => É kit
                    [value_id] => -1
                    [value_name] => 
                )

            [20] => Array
                (
                    [id] => PRODUCT_FEATURES
                    [name] => Características do produto
                    [value_id] => -1
                    [value_name] => 
                )

            [21] => Array
                (
                    [id] => PRODUCT_CHEMICAL_FEATURES
                    [name] => Características químicas do produto
                    [value_id] => -1
                    [value_name] => 
                )

            [22] => Array
                (
                    [id] => FOODS_AND_DRINKS
                    [name] => Alimentos e bebidas
                    [value_id] => -1
                    [value_name] => 
                )

            [23] => Array
                (
                    [id] => MEDICINES
                    [name] => Medicamentos
                    [value_id] => -1
                    [value_name] => 
                )

            [24] => Array
                (
                    [id] => BATTERIES_FEATURES
                    [name] => Características das baterias
                    [value_id] => -1
                    [value_name] => 
                )

            [25] => Array
                (
                    [id] => SHIPMENT_PACKING
                    [name] => Embalagem do envío
                    [value_id] => -1
                    [value_name] => 
                )

            [26] => Array
                (
                    [id] => ADDITIONAL_INFO_REQUIRED
                    [name] => Informação adicional requerida
                    [value_id] => -1
                    [value_name] => 
                )

            [27] => Array
                (
                    [id] => JAN
                    [name] => JAN
                    [value_id] => -1
                    [value_name] => 
                )

            [28] => Array
                (
                    [id] => GTIN14
                    [name] => GTIN-14
                    [value_id] => -1
                    [value_name] => 
                )

        )

    [variations] => Array
        (
            [0] => Array
                (
                    [id] => 
                    [attribute_combinations] => Array
                        (
                            [0] => Array
                                (
                                    [id] => COLOR
                                    [name] => Cor
                                    [value_id] => 52019
                                    [value_name] => Verde-escuro
                                )

                        )

                    [price] => 8.94
                    [available_quantity] => 2
                    [seller_custom_field] => 99V5
                    [sold_quantity] => 0
                    [picture_ids] => Array
                        (
                            [0] => https://img.quizur.com/f/img5d7edfcad90e41.36599685.jpg
                        )

                )

        )

    [status] => active
    [currency_id] => BRL
    [buying_mode] => buy_it_now
    [listing_type_id] => gold_special
    [condition] => new
    [video_id] => 
    [warranty] => 30
    [site_id] => MLB
    [shipping] => Array
        (
            [mode] => me2
            [local_pick_up] => 
            [free_shipping] => 
            [free_methods] => Array
                (
                )

        )

)
</pre>

 

 

 

Porém, recebo a seguinte resposta:

 


<pre>
Array
(
    [body] => stdClass Object
        (
            [message] => Validation error
            [error] => validation_error
            [status] => 400
            [cause] => Array
                (
                    [0] => stdClass Object
                        (
                            [department] => structured-data
                            [cause_id] => 1210
                            [type] => warning
                            [code] => normalize.item.attribute.value_id
                            [references] => Array
                                (
                                    [0] => item.variations[0].attribute_combinations[0].value_id
                                )

                            [message] => Attribute [COLOR] to be modified - value_id [52019] will be [null]
                        )

                    [1] => stdClass Object
                        (
                            [department] => items
                            [cause_id] => 146
                            [type] => error
                            [code] => item.attributes.invalid
                            [references] => Array
                                (
                                    [0] => item.attributes
                                    [1] => item.variations.attribute_combinations
                                    [2] => item.variations.attributes
                                )

                            [message] => Same attributes are used in more than of item.attributes, variation.attribute_combinations and variation.attributes
                        )

                    [2] => stdClass Object
                        (
                            [department] => structured-data
                            [cause_id] => 1210
                            [type] => warning
                            [code] => normalize.item.attribute.value_id
                            [references] => Array
                                (
                                    [0] => item.attributes[0].value_id
                                )

                            [message] => Attribute [COLOR] to be modified - value_id [283165] will be [null]
                        )

                )

        )

    [httpCode] => 400
)

</pre>

 

 

Reparem, que os ids das cores são diferentes, mas parece que a API não reconhece nenhum deles. Eu já tentei mandar somente o  <i>value_name</i> porem sem sucesso.
Pelo que vi na documentação, minha sintaxe está aparentemente correta...
Enfim, esgotei minhas ideias e por isso venho até vós.

Grato desde já.

 

 

Os erros são autoexplicativos até

Same attributes are used in more than of item.attributes, variation.attribute_combinations and variation.attributes

Se um atributo tem a tag variation_attribute valendo true você não pode declarar ele em attributes , variation.attributes e variation_atribute_combination ao mesmo tempo

 

[message] => Attribute [COLOR] to be modified - value_id [52019] will be [null]

Aonde tu viu que essa categoria tem atributo color ?

https://api.mercadolibre.com/categories/MLB270416/attributes

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this