Question

I have this type of WebService

enter image description here

How can I get products detail using Magento 1.9, kindly explain me in detail that how can I get data using this Webservice. If someone can list down the step how can I achieve this.

Really appreciate for help.

Was it helpful?

Solution

You can follow steps below carefully to call magento API

step 1: Create SOAP Role from Admin Panel

1) Please go to System -> Web Service -> SOAP/XML-RPC -Roles

2) Click "Add New Role".

3) Enter Role name (like "api_user") and enter admin password

4) Select Role Resources. You can select All or Custom depending on your needs.

5) Click "Save Role" button.

enter image description here

step 2: Create SOAP User from Admin Panel

1) Please go to System -> Web Service -> SOAP/XML-RPC -Users

2) click Add New user

3) Please enter all data for new soap user. Make sure you have saved the "User Name" and the "API Key" in a file for feature use in API call.

4) Click "User Role" tab.

5) Select the role to assign to the Soap user

6) click "Save user" button

enter image description here

**step 3: create a php file , Call the Magento Product details API **

Note: Please change soap user name, API key and Web Url with your data from the php script.

<?php
error_reporting(-1);
ini_set('display_errors', 'On');
const SOAP_API_USER = 'your_soap_user_name';
const SOAP_API_PASS = 'your_soap_api_key';
const SOAP_API_ENDPOINT = 'http://YOURPROJECTWEBURL/index.php/api/v2_soap/?wsdl';

$soapClient = new SoapClient(SOAP_API_ENDPOINT, array('trace' => true,
'keep_alive' => true,
'connection_timeout' => 5000,
'cache_wsdl' => WSDL_CACHE_NONE,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,));

$sessionId = $soapClient->login(SOAP_API_USER, SOAP_API_PASS); // apiUser , apiKey        
$productId  = 4; // Product Id to get details
$result = $soapClient->catalogProductInfo($sessionId,$productId);
var_dump($result);

OTHER TIPS

How you see the XML output ? I can see object and array only please guide me how can i see XML format for this API request please urgent

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top