i got error of my magento api than i creating the product:
Fatal error: Uncaught SoapFault exception: [2] Access denied. in /Applications/MAMP/htdocs/magento/soap.php:210 Stack trace: #0 /Applications/MAMP/htdocs/magento/soap.php(210): SoapClient->__call('call', Array) #1 /Applications/MAMP/htdocs/magento/soap.php(210): SoapClient->call('2017c612ade741b...', 'product_attribu...') #2 /Applications/MAMP/htdocs/magento/soap.php(90): Client->_APIgetAttributeSets() #3 /Applications/MAMP/htdocs/magento/soap.php(269): Client->APIcreateNewProduct(Array) #4 {main} thrown in /Applications/MAMP/htdocs/magento/soap.php on line 210
this is my method:
public function APIcreateNewProduct( $newProductData ) {
$error = array();
if( empty( $newProductData ) ) {
$error[] = 'Empty product data';
}
if( empty( $error ) ) {
$token = $this->_getToken();
$client = $this->_getClient();
//90 line
$set = $this->_APIgetAttributeSets();
$productId = $client->call($token, self::CREATE_PRODUCT, array('simple', $set['set_id'], rand().'sku_of_product', $newProductData));
return $productId;
} else {
return $this->_apiJsonResult( $error );
}
}
and its _APIgetAttributeSets():
private function _APIgetAttributeSets() {
$token = $this->_getToken();
$client = $this->_getClient();
//210 LINE
$attributeSets = $client->call($token, self::PRODUCT_ATTRIBUTE_LIST);
$set = current($attributeSets);
return $set;
}
Login and retrieving the product list are fine.
where is my mistake with creating? thank you
You need to check this webservice user has given create and delete right in backend. if not then give right for create product and check it.