• 0
NatanMall

"description":[{"plain_text":""} help

Question

alguém pode me ajudar com isso??

    "description":[
        {"plain_text":"Detalhes do Produto"}
    ],

a formula JSON esta correta, mais o retorno da API é!

{
    "message": "body.invalid_field_types",
    "error": "validation_error",
    "status": 400,
    "cause": [
        {
            "cause_id": 101,
            "type": "error",
            "code": "body.invalid_field_types",
            "references": [
                "item.description"
            ],
            "message": "invalid property type: [description] expected String but was JSONArray value: [[plain_text:]]"
        }
    ]
}

e quando eu mando sem o plain_text  API retorna um warning: The text property is deprecated. And will soon be rejected. Please use plain_text

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 1
43 minutes ago, NatanMall said:

"description":[{"plain_text":"Detalhes do Produto<br>Batedeira Orbit Colors da Cadence"}],

mude para:

"description":{"plain_text":"Detalhes do Produto<br>Batedeira Orbit Colors da Cadence"}

 

OBS.: retire a tag <br> , como o próprio nome diz é plain_text (texto plano), não devem ser utilizadas tags HTML

Share this post


Link to post
Share on other sites
  • 0

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.mercadolibre.com/items?access_token=APP_USR-1076320792228583-121310-79a14b9d74f74790f715584fcb28ce6c-385942583",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{"title":"Batedeira Cadence 8 Velocidades 400W - 220v - não Ofertar",
"category_id":"MLB196958",
"price":910,
"currency_id":"BRL",
"available_quantity":2,
"buying_mode":"buy_it_now",
"listing_type_id":"bronze",
"condition":"new",
"description":[{"plain_text":"Detalhes do Produto<br>Batedeira Orbit Colors da Cadence"}],
"video_id": "",
"warranty": "12 meses",
"pictures":[{"source":"https://teste.achaddo.com.br/panel/data/Ray_Ban_Original_Wayfarer.jpg"},
{"source":"https://teste.achaddo.com.br/panel/data/Teashades.gif"}
]}",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Content-Type: application/json",
"Postman-Token: 0174cbf3-c5c4-4f95-9f08-4c7071028c10",
"cache-control: no-cache"),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

----------------------------------------------------------------------------------------------------

o retorno no postman é esse

{
    "message": "body.invalid_field_types",
    "error": "validation_error",
    "status": 400,
    "cause": [
        {
            "cause_id": 101,
            "type": "error",
            "code": "body.invalid_field_types",
            "references": [
                "item.description"
            ],
            "message": "invalid property type: [description] expected String but was JSONArray value: [[plain_text:Detalhes do Produto<br>Batedeira Orbit Colors da Cadence.]]"
        }
    ]
}

a formula JSON esta correta, não sei o que esta acontecendo!

Edited by NatanMall

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now