如何调用方法magento-api


how to call method magento api

im正在使用magento api,我需要验证我的连接。如何用$client对象调用方法APIauthentication?因为我在以下方面出错:Error: Function ("APIauthentication") is not a valid method for this service

谢谢你的帮助。

这是我的课:

<?php
class Magento {
const PRODUCTS_LIST = 'catalog_product.list';
public function Verify( $data )
{
        $client = new SoapClient( $data['store_url'] );
        $verify = $client->APIauthentication( $data['api_user'], $data['api_key'] );
        if ($verify)
        {
            return $this->Register( $data['store_url'], $data['api_user'], $data['api_key'] );
        }
}
public function APIauthentication( $apiUser, $apiKey ) {
        $client = $this->_getClient();
        $token = $client->login( $apiUser, $apiKey );
        $this->_setToken( $token );
        return $this->_apiJsonResult( $token );
}
}

有url:

$data['store_url'] = 'http://localhost:8888/magento/api/soap/?wsdl';

首先我需要验证,第二个获取列表:

// For products
public function getProducts()
{
    return $client->APIgetProductsList();
}
/*
     * Get product list
     */
    public function APIgetProductsList() {
        $token = $this->_getToken();
        $client = $this->_getClient();
        $products = $client->call($token, self::PRODUCTS_LIST );
        return $this->_apiJsonResult( $products );
}

您需要通过创建新模块来创建自己的api,然后才能使用该api方法。请参阅此链接http://www.magentocommerce.com/wiki/5_-_modules_and_development/web_services/custom_api_complete_example