I want to POST price to update sale price Hepsiburada Webservices [closed]

2 weeks ago 37

# {"errors":{"items":["Cannot deserialize the existent JSON entity (e.g. {"name":"value"}) into benignant 'System.Collections.Generic.List`1[ListingService.ExternalCore.RequestModels.PriceUploadRequestModel]' due to the fact that the benignant requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\nTo hole this mistake either alteration the JSON to a JSON array (e.g. [1,2,3]) oregon alteration the deserialized benignant truthful that it is simply a mean .NET benignant (e.g. not a primitive benignant similar integer, not a postulation benignant similar an array oregon List) that tin beryllium deserialized from a JSON object. JsonObjectAttribute tin besides beryllium added to the benignant to unit it to deserialize from a JSON object.\nPath 'items', enactment 1, presumption 9."]},"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One oregon much validation errors occurred.","status":400,"traceId":"00-eb38f0fede95da6bc2b094a49a6e0be5-ed04008bff469736-00"}

I got this error.This is simply a codification that I americium trying to POST to beryllium updated from Hepsiburada web work astatine a discount price, but arsenic acold arsenic I understand, it is simply a JSON record type, determination is simply a occupation successful creating it, but I could not lick it.

<?php $obj->items = $items; $myJSON = json_encode($obj,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); // json record $argsForProducts = array( 'body' => $myJSON, 'headers' => array('Authorization' => 'Basic ' . base64_encode( $hbMerchant . ':' . $hbPassword),'Content-Type' => 'application/json; charset=utf-8','User-Agent' => $hbDevelopername.' - SelfIntegration'), ); // codification for station webservices $response = wp_remote_post( 'https://api.trendyol.com/sapigw/suppliers/'.$hbDevelopername.'/products/price-and-inventory', $argsForProducts); $body = wp_remote_retrieve_body( $response ); $jset = json_decode($body, true); echo $offset.' - '.$limit.'<br>'; echo '<pre>'; print_r($body); echo '</pre>'; //$offset += $limit; break; } ?>
Read Entire Article