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

Update a product return error : Error: Missing parameter data [woocommerce_api_missing_callback_param] 400

Open RazV3R opened this issue 10 years ago • 2 comments

I have tested with these and they worked

print_r( $client->products->get() ); print_r( $client->products->get( $product_id ) ); print_r( $client->products->create( array( 'title' => 'Test Product', 'type' => 'simple', 'regular_price' => '9.99', 'description' => 'test' ) ) ); print_r( $client->products->delete( $product_id, true ) );

but when I do update product it doesn't update and show error print_r( $client->products->update( $product_id, 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] => xxxx
[params] => Array
    (
        [oauth_consumer_key] => xxxx
        [oauth_timestamp] => xxxx
        [oauth_nonce] => xxxx
        [oauth_signature_method] => xxxx
        [oauth_signature] => xxxx
    )

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

    )

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

) stdClass Object ( [body] => {"errors":[{"code":"woocommerce_api_missing_callback_param","message":"Missing parameter data"}]} [code] => 400 [headers] => Array ( [Date] => Wed, 28 Oct 2015 13:51:51 GMT [Content-Type] => application/json; charset=UTF-8 [Content-Length] => 97 [Connection] => keep-alive [Keep-Alive] => timeout=30 [Server] => Apache/2 [X-Powered-By] => PHP/5.3.29 [Vary] => User-Agent,Accept-Encoding )

)

RazV3R avatar Oct 28 '15 14:10 RazV3R

I'm facing same issue when updating a product using API. Did you solve this?

Agapito78 avatar Jan 04 '17 17:01 Agapito78

I'm also facing same issue when updating a product using API.

Error: Missing parameter data [woocommerce_api_missing_callback_param] 400

priyasahoo avatar Jan 11 '17 09:01 priyasahoo