Hi,
I've added a custom attribute 'residency' to customers which I'll use on registration.
I've been using this parameters:
{
"customer": {
"email": "customer@test.com",
"firstname": "abc",
"lastname": "def",
"dob": "1994-01-21",
"gender": 1,
"store_id":1,
"residency": "testResidency"
},
"password": "Password1234"
}
Methods that i've tried:
note:
when I register thru my customer registration page. the attribute is being populated.
its just that when I call the rest API that Im having issues.
Any help would be greatly appreciated. Thanks!
REST api: V1/customers
Solved! Go to Solution.
I've got it working.
for those that might run into the same problem.
all I did was make a extension_attributes.xml and change the way I pass the custom attributes on my parameters.
Custom attribute: residency
extension_attributes.xml:
<?xml version="1.0"?> <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="residency" type="string"/> </extension_attributes> </config>
parameters:
{ "customer": { "email": "test@customer.com", "firstname": "abc", "lastname": "def", "dob": "1994-01-21", "gender": 1, "store_id":1, "extension_attributes": { "residency":"sample residency" } }, "password": "Password1234" }
I've got it working.
for those that might run into the same problem.
all I did was make a extension_attributes.xml and change the way I pass the custom attributes on my parameters.
Custom attribute: residency
extension_attributes.xml:
<?xml version="1.0"?> <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="residency" type="string"/> </extension_attributes> </config>
parameters:
{ "customer": { "email": "test@customer.com", "firstname": "abc", "lastname": "def", "dob": "1994-01-21", "gender": 1, "store_id":1, "extension_attributes": { "residency":"sample residency" } }, "password": "Password1234" }
have you created plugin for the same??