Magento API provides ability to manage your eCommerce website by accessing api calls for Products, customers, sales order and categories etc. You can also manage inventory and shopping cart via magento api calls.
Magento API Integration using PHP:
1) Create a Web Service User Role:
Very first step is to create a web service user role in your magento store. To create it Go to System -> Web Services -> Roles in your admin panel. Click on Add New Role and enter the your role name in Role Information box.
2) Now click on the Role Resources tab. Select the resource access for this user role and than save the role.
3) Create Web Service User:
Now create a new user, go to System -> Web Services -> Users and click on Add New User option. Fill all the required information in form. Must choose unique Api key, and make account as active.
Under User role tab make sure that assign previous created API Role than save the user. Now you are ready to use Magento API. Check below one api code sample to get List of Order via Magento api call in PHP.
Get Magento List Order Data Via Api Call in PHP:
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php $proxy = new SoapClient('http://magentohost/api/soap/?wsdl'); // Replace magentohost with your store url $sessionId = $proxy->login('username', 'API KEY'); // use created user role username and API KEY here $products = $proxy->call($sessionId, 'product.list'); echo "<pre>"; print_r($products); ?> |
Using above code sample you can use other Magento API methods. Check here for complete list of Magento Methods:
http://devdocs.magento.com/guides/m1x/api/soap/introduction.html
If any issue get feel free to contact me. Thanks