• 0
Sign in to follow this  
aiesque

error al republicar

Question

Hola estamos teniendo un problema que casi seguro es algun error nuestro pero es raro.
Al intentar republicar un item  si los tres campo estan pasados por la URL  al llamar a la api retorna :
"{"message":"price field not found or invalid","error":"price.invalid","status":400,"cause":[]}"
 
Ahora si los mismos campos los declaro dentro (valores fijos ) del php Funciona perfecto!!!!
Envío la estructura del php.
 
 
$strBaseURI="https://api.mercadolibre.com/items/".$id."/relist?access_token=".$at;
$strResponseFormat='application/json';
$strRequestFormat='application/json';
$ch = curl_init();
$cantidad=$_GET["cantidad"];
$destaque=$_GET["destaque"];
$precio=$_GET["precio"];
 
// si declaro las variables con sus valores en php anda bien //$precio=11.4; $cantidad=2;$destaque='gold_special'; curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); curl_setopt($ch, CURLOPT_URL, $strBaseURI ); curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: ' . $strResponseFormat, 'Content-type: ' . $strRequestFormat)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $arr = array( "price" => $precio,"quantity" => $cantidad , "listing_type_id" => $destaque); curl_setopt ($ch, CURLOPT_POSTFIELDS, json_encode($arr)); $result=curl_exec ($ch); curl_close ($ch);
 
 

Agradecemos cualquier ayuda que nos puedan brindar

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

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
Sign in to follow this