How to Get Customer Information Using SOAP API in Magento 2

How to Get Customer Information Using SOAP API in Magento 2

Hello Magento Friends,

Today I am going to explain How to obtain Customer Details Using SOAP API in Magento 2.

SOAP API allows web applications to communicate across the internet and HTTP which is supported by all the browsers and servers. SOAP API provides easy data transfer between external systems and Magento 2.

When you need customer data outside the Magento platform, you can accomplish it using SOAP API. Let’s learn How to Get Customer Information Using SOAP API in Magento 2.

Steps to Get Customer Information Using SOAP API in Magento 2:

Step 1: Create call_soap.php file anywhere and add the following code

<?php
$request = new SoapClient("http://yourdomain/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2));
// changed your store url.
$token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"admin", "password"=>"admin@1234"));

$request = new SoapClient(
    'http://yourdomain/soap/default?wsdl&services=customerCustomerRepositoryV1',
    array(
        'soap_version' => SOAP_1_2,
        'stream_context' => stream_context_create(array(
            'http'=> array('header' => 'Authorization: Bearer '.$token->result)
        ))
    )
);
// you need pass customer id in array
$response = $request->customerCustomerRepositoryV1GetById(array("customerId" => 3));
echo "<pre>";
print_r($response);
echo "</pre>";
?>

Conclusion:

Hence, this was about fetching customer details using SOAP API in Magento 2. Similarly, Get Order Information Using SOAP API in Magento 2. If you face any challenges, get in touch with me through the comment part. Share the article with others and see you in the next article.

Happy Coding!

Previous Article

How to Solve the Issue of Product with Salable Qty 0 is not considered Out of Stock in Magento 2?

Next Article

The Complete List of Google Algorithm Updates in 2021

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨