• 0
fabiogomez28

error validating location and parameters category

Question

estoy enviando el siguiente post para publicar un item

 
$item = array(
  "title" => "Property title",
  "category_id" => "MCO1468",
  "price" => 1000000,
  "currency_id" => "COP",
  "available_quantity" => 1,
  "buying_mode" => "classified",
  "listing_type_id" => "silver",
  "condition" => "not_specified",
  "pictures" => array(array(
    'id'=>'',
  )),
  "seller_contact" => array(
    "contact" => "Fabio gomez guzman",
    "other_info" => "other info",
    "area_code" => "011",
    "phone" => "4444-5555",
    "area_code2" => "1234",
    "phone2" => "4454344",
    "email" => "test_user_401069@testuser.com",
    "webmail" => "desarrollo@dynamicweb.co"
  ),
   "attributes" => array(
array(
  "ID" => "MCO1459-MTRS",
  "value_name" => "300"
),
    array(
      "ID" => "MCO1459-ANTIG",
      "value_name" => "60"
    ),
    array(
      "ID" => "MCO1459-BATHQTY",
      "value_id" => "MCO1459-BATHQTY-4"
    ),
    array(
      "ID" => "MCO1459-HABPISO",
      "value_id" => "MCO1459-HABPISO-4"
    ),
    array(
      "ID" => "MCO1459-MTRSTOTAL",
      "value_id" => "300"
    ),
    array(
      "ID" => "MCO1466-VALUEADMIN",
      "value_name" => "100000"
    ),
    array(
      "ID" => "MCO1459-ESTRATO",
      "value_id" => "MCO1459-ESTRATO-4"
    ),
   ),
  
  "location" => array(
    "address_line" => "Cra 29 a # 49 a 31",
    "zip_code" => "01234567",
    "neighborhood" => array(
      "ID" => "TUNPQjNERTQ2MDYyOA"
    ),
    "latitude" => -34.48755,
    "longitude" => -58.56987,
  ),
  
);
 
 pero estoy teniendo dos errores
1. no me reconoce el "location" a pesar de que envio el barrio con su respectivo id https://api.mercadolibre.com/classified_locations/neighborhoods/TUNPQjNERTQ2MDYyOA y me retorna el siguiente error de validación: Field 'location' requires up to city level. [country.name: null, state.name: null, city.name: null] 
2. no me reconoce los atributos que envió en el tag "attributes" y me dice que no le estoy enviando los atributos obligatorios  The attributes [MCO1459-MTRS, MCO1459-ANTIG, MCO1459-BATHQTY, MCO1459-HABPISO] are required for category MCO1468. Check the attribute is present in the attributes list or in all variation attributes combination.
 
Array
(
[body] => stdClass Object
(
[message] => Validation error
[error] => validation_error
[status] => 400
[cause] => Array
(
[0] => stdClass Object
(
 => item.attributes.missing_required
[message] => The attributes [MCO1459-MTRS, MCO1459-ANTIG, MCO1459-BATHQTY, MCO1459-HABPISO] are required for category MCO1468. Check the attribute is present in the attributes list or in all variation attributes combination.
)

[1] => stdClass Object
(
[code] => item.attributes.invalid
[message] => The attributes [null, null, null, null, null, null, null] are invalid for category MCO1468
)

[2] => stdClass Object
(
[code] => item.location.invalid
[message] => Field 'location' requires up to city level. [country.name: null, state.name: null, city.name: null]
)

[3] => stdClass Object
(
[code] => nullable
[message] => Property [attributeId] cannot be null
)

[4] => stdClass Object
(
[code] => nullable
[message] => Property [attributeId] cannot be null
)

[5] => stdClass Object
(
[code] => nullable
[message] => Property [attributeId] cannot be null
)

[6] => stdClass Object
(
[code] => nullable
[message] => Property [attributeId] cannot be null
)

[7] => stdClass Object
(
[code] => nullable
[message] => Property [attributeId] cannot be null
)

[8] => stdClass Object
(
[code] => nullable
[message] => Property [attributeId] cannot be null
)

[9] => stdClass Object
(
[code] => nullable
[message] => Property [attributeId] cannot be null
)

)

)

[httpCode] => 400
)

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hola fabiogomez28, 

Te comento los puntos:

01 - Para enviar los locations, hay que enviar todos los ids, por ejemplo:
 

"neighborhood": {
      "id": "TUNPQjNERTQ2MDYyOA"
    },
    "city": {
      "id": "TUNPQ0NBTDYyZDA0"
    },
    "state": {
      "id": "TUNPUFZBTGExNmNjNg"
    },
    "country": {
      "id": "CO"
    },

02 - Los atributos no se reconocen porque deben escribirse todos en minúsculas, te pasó su JSON como sería la manera correcta:

{
  "title":"Property title",
  "category_id":"MCO1468",
  "price":1000000,
  "currency_id":"COP",
  "available_quantity":1,
  "buying_mode":"classified",
  "listing_type_id":"silver",
  "condition":"not_specified",
  "pictures":[
    {
    "source":"http://upload.wikime...SouthFacade.JPG"
    }
  ],
  "seller_contact":{
    "contact":"Fabio gomez guzman",
    "other_info":"other info",
    "area_code":"011",
    "phone":"4444-5555",
    "area_code2":"1234",
    "phone2":"4454344",
    "email":"test_user_401069@testuser.com",
    "webmail":"desarrollo@dynamicweb.co"
  },
  "attributes": [
    {
      "id":"MCO1459-MTRS",
      "value_name":"300"
    },
    {
      "id":"MCO1459-ANTIG",
      "value_name":"60"
    },
    {
      "id":"MCO1459-BATHQTY",
      "value_id":"MCO1459-BATHQTY-4"
    },
    {
      "id":"MCO1459-HABPISO",
      "value_id":"MCO1459-HABPISO-4"
    },
    {
      "id":"MCO1459-MTRSTOTAL",
      "value_name":"300"
    },
    {
      "id":"MCO1466-VALUEADMIN",
      "value_name":"100000"
    },
    {
      "id":"MCO1459-ESTRATO",
      "value_id":"MCO1459-ESTRATO-4"
    }
   ],
  "location": {
    "address_line": "Cra 29 a # 49 a 31",
    "zip_code": "01234567",
    "neighborhood": {
      "id": "TUNPQjNERTQ2MDYyOA"
    },
    "city": {
      "id": "TUNPQ0NBTDYyZDA0"
    },
    "state": {
      "id": "TUNPUFZBTGExNmNjNg"
    },
    "country": {
      "id": "CO"
    },
    "latitude": "",
    "longitude": "",
    "open_hours": ""
  }
}

Saludos!

 

Share this post


Link to post
Share on other sites
  • 0

Porqué no es posible modificar los atributos luego de hacer una publicación de un inmueble  ??

 

Me sale este error de validacion al tratar de modificar los atributos.

 

 {"message":"Cannot update item MLAXXXXXXXXXX [status:payment_required, has_bids:false]","error":"validation_error","status":400,"cause":[{"code":"item.attributes.not_modifiable","message":"attributes is not modifiable."}]}

Share this post


Link to post
Share on other sites
  • 0

Buen día, no entiendo que me hace falta en esto, espero me puedan ayudar, estoy usando wordpress para hacer las variaciones pero no logro hacer que cuadren, 
 

  • Autopartes, piezas y refacciones Volvo V40 Causa: Array ( [body] => stdClass Object ( [message] => Validation error [error] => validation_error [status] => 400 [cause] => Array ( [0] => stdClass Object (
 => item.variations.attribute_combinations.invalid [message] => Attributes [MLM1907-YEAR] are invalid for category MLM95042. Check that they exist and allow variations. ) [1] => stdClass Object ( [code] => item.location.invalid [message] => Field 'location' requires up to city level. [country.name: null, state.name: null, city.name: null] ) ) ) [httpCode] => 400 [title] => Autopartes, piezas y refacciones Volvo V40 )

Dejo algunas capturas de pantalla: 

 https://www.dropbox.com/s/lm7h3ncrgkvhdue/Captura%20de%20pantalla%202017-02-28%2009.05.38.png?dl=0

 https://www.dropbox.com/s/qi42qwmpg0s4sxx/Captura%20de%20pantalla%202017-02-28%2009.05.46.png?dl=0

post-1714-0-11225600-1488294500_thumb.png

post-1714-0-73327500-1488294500_thumb.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...