0

I used SOAP API '{$baseUrl}soap/default?wsdl&services=customerCustomerRepositoryV1' to get customer attributes values. I am successfully getting these attributes values like name, email etc all default values but i have not able to get custom customer attributes

0

You have to use extension attribute concept for enable a custom attribute to API .

How to use extension attributes for customer EAV attributes?

Add this attribute as extension attribute using extension_attribute.xml. Create this file at your app/code/{VendorName}/{Module}/etc and add below code

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
        <attribute code="{YOurAttributeCode}" type="string" />
    </extension_attributes>
</config>

Type is depend on attribute type, if it is a Varchar & text,multiselect field, then use string. If it is drop down,Yes/no then use as interger.

  • Thanks @Amit for answer i would like to know one more thing i am using this script for create customer (magento.stackexchange.com/questions/173722/…) & i need to add custom customer attribute data to it. How can i achieve this? – Arjun Apr 22 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.