私はAPI呼び出しを行いたいと思います。私はWordPress用のWoocommerceプラグインを使用しています。ヘルプと情報が必要Woocommerceに関するヒントを作成するAPI
<?php
require_once('../lib/woocommerce-api.php');
$consumer_key = 'ck_0cfc7bc73277efd3eb665b52234ae8939b39cb0a'; // Add your own Consumer Key here
$consumer_secret = 'cs_ef229872c4620c46d1b71b52537b3279e0e9dcdb'; // Add your own Consumer Secret here
$store_url = 'http://example.net'; // Add the home URL to the store you want to connect to here
$options = array(
'debug' => true,
'return_as_array' => false,
'validate_url' => false,
'timeout' => 30,
'ssl_verify' => false,
);
try {
$client = new WC_API_Client($store_url, $consumer_key, $consumer_secret, $options);
print_r($client->orders->create($data));
} catch (WC_API_Client_Exception $e) {
echo $e->getMessage() . PHP_EOL;
echo $e->getCode() . PHP_EOL;
if ($e instanceof WC_API_Client_HTTP_Exception) {
print_r($e->get_request());
print_r($e->get_response());
}
}
私のエラー:
私は、だから私は順序私のコードを作成するための基本的なAPIコマンドを使用していkloon/WooCommerce-REST-API-Client-Library
を使用してセットアップするためのAPIをしようとしています
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] => POST [url] =>http://example.net/test/wc-api/v2/orders?oauth_consumer_key=ck_0cfc7bc73277efd3eb665b52234ae8939b39cb0a&oauth_timestamp=1477892703&oauth_nonce=08e418dcf02c304ccfab4d09ed3233074acc4f11&oauth_signature_method=HMAC-SHA256&oauth_signature=HqW4ra%2F3EPhnByREOQjG9VybB2FjSpDJhC0PVVSnUZ8%3D [params] => Array ([oauth_consumer_key] => ck_0cfc7bc73277efd3eb665b52234ae8939b39cb0a [oauth_timestamp] => 1477892703 [oauth_nonce] => 08e418dcf02c304ccfab4d09ed3233074acc4f11 [oauth_signature_method] => HMAC-SHA256 [oauth_signature] => HqW4ra/3EPhnByREOQjG9VybB2FjSpDJhC0PVVSnUZ8=) [data] => [body] => null [duration] => 1.14179) stdClass Object ([body] => {"errors":[{"code":"woocommerce_api_missing_callback_param","message":"Missing parameter data"}]} [code] => 400 [headers] => Array ([Date] => Mon, 31 Oct 2016 05:45:04 GMT [Server] => Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips [X-Powered-By] => PHP/5.6.26 [Vary] => Accept-Encoding [Connection] => close [Transfer-Encoding] => chunked [Content-Type] => application/json; charset=UTF-8))
誰かが私を助けることができますか?私は何をすべきか ?