WooCommerce-REST-API-Client-Library icon indicating copy to clipboard operation
WooCommerce-REST-API-Client-Library copied to clipboard

Error Update product - Missing Parameter Data [woocommerce_api_missing_callback_param]

Open Agapito78 opened this issue 9 years ago • 0 comments

Hi, I'm getting the error message below when trying to update a product. I'm able to create a product but when I try to update I get the error below

Code: $clientID = "ck_9826vaba5e42366227f19y389ef456c92342c36d241g"; $clientSecretKey ="cs_9826vaba5e42366227f19y389ef456c92342c36d241g" $options = array ( 'debug' => true, 'return_as_array' => false, 'validate_url' => false, 'timeout' => 30, 'ssl_verify' => 2 );

$store_url = "https://www.twss.com.br/store";

$wc_api = new WC_API_Client ( $store_url, $clientID, $clientSecretKey, $options );
$retWoo = $wooapi->products->update("4555",array( 'title' => 'Yet another test product' ));

Error: Missing Parameter Data [woocommerce_api_missing_callback_param] 400 stdClass Object ( [headers] => Array ( [0] => Accept: application/json [1] => Content-Type: application/json [2] => User-Agent: WooCommerce API Client-PHP/2.0.1 )

[method] => PUT
[url] => https://www.twss.com.br/store/wc-api/v2/products/4555?consumer_key=ck_9826vaba5e42366227f19y389ef456c92342c36d241g&consumer_secret=cs_9826vaba5e42366227f19y389ef456c92342c36d241g
[params] => Array
    (
        [consumer_key] => ck_9826vaba5e42366227f19y389ef456c92342c36d241g
        [consumer_secret] => cs_9826vaba5e42366227f19y389ef456c92342c36d241g
    )

[data] => Array
    (
        [product] => Array
            (
                [title] => Yet another test product
            )

    )

[body] => {"product":{"title":"Yet another test product"}}
[duration] => 0.63256

) stdClass Object ( [body] => {"errors":[{"code":"woocommerce_api_missing_callback_param","message":"Missing Parameter Data"}]} [code] => 400 [headers] => Array ( [Date] => Thu, 05 Jan 2017 14:27:22 GMT [Server] => Apache [Set-Cookie] => PHPSESSID=4nvbngv20vlql08arg5nvkcsi6; path=/ [Expires] => Thu, 19 Nov 1981 08:52:00 GMT [Cache-Control] => no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [Pragma] => no-cache [Connection] => close [Transfer-Encoding] => chunked [Content-Type] => application/json; charset=UTF-8 )

)

Agapito78 avatar Jan 05 '17 14:01 Agapito78