cancel
Showing results for 
Search instead for 
Did you mean: 

Any default api available for create customer in magento 1.9

Any default api available for create customer in magento 1.9

hai,

Can anyone please give the solution to below.

Any default API available to create a customer in magento 1.9

5 REPLIES 5

Re: Any default api available for create customer in magento 1.9

Hello @sujithathanga

 

Please follow below or you can follow below official doc: https://devdocs.magento.com/guides/m1x/api/soap/customer/customer.create.html

Example: Request Example SOAP V1

$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session,'customer.create',array(array('email' => 'mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1)));

var_dump ($result);

// If you don't need the session anymore
//$client->endSession($session);

Request Example SOAP V2

$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->customerCustomerCreate($session, array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));

var_dump ($result);

Request Example SOAP V2 (WS-I Compliance Mode)

$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey')); 
 
$result = $proxy->customerCustomerCreate((object)array('sessionId' => $sessionId->result, 'customerData' => ((object)array(
'email' => 'customer-mail@example.org',
'firstname' => 'John',
'lastname' => 'Dou',
'password' => '123123',
'website_id' => '0',
'group_id' => '1'
))));   
var_dump($result->result);
Manish Mittal
https://www.manishmittal.com/

Re: Any default api available for create customer in magento 1.9

Thanks for your response.

 I have tried the above but It shows "Fatal error: Uncaught SoapFault exception: [2] Access denied. "

 

Kindly give me the solution.

Re: Any default api available for create customer in magento 1.9

@sujithathanga

Use this and follow below-shared link:

https://magento.stackexchange.com/questions/8187/fatal-error-uncaught-soapfault-exception-2-access-d...

$client = new SoapClient('http://www.comain.co.uk/api/v2_soap?wsdl=1');$session = $client->login('username', 'apikey');$result = $client->catalogInventoryStockItemList($session, array('27847')); // Products IDprint_r($result);

 

Manish Mittal
https://www.manishmittal.com/

Re: Any default api available for create customer in magento 1.9

Hello @sujithathanga,

 

 

This is because the SOAP version and the web-service call methods are mismatchings...

Please try this URL  http://mylivedomain.com/api/soap/?wsdl

 

 

--
If my answer is useful, please Accept as Solution & give Kudos

Re: Any default api available for create customer in magento 1.9

Ok thank you