Home » Uncategorized » Magento v2 API

Magento v2 API

Step to use Soap API V2 : Example to get customer list using soap v2 api

Step 1 : Create Role : Go to System > Web Services > SOAP/XML-RPC – Role and create Role and assign a resource to your role.
Step 2 : Craete Users: Go to System > Web Services > SOAP/XML-RPC – Use  and create User and assign created role.Note down User Name(This will be ApiUserName and ApiKey
Step 3 : Call Soap methods : Use below code to call soap methods . For eg getCustomerList


$host = 'http://magentohost/api/v2_soap?wsdl=1';
$client = new SoapClient($host);
// then get a session token
$session = $client->login('ApiUserName', 'ApiKey');
// call soap method
$result = $client->customerCustomerList($session);
print_r($result);

Leave a comment