1

Can someone please help me out in overwriting the REST API with Magento 2.3 for customer registeration, please describe with example.

1

You need to create a webapi.xml file under etc folder within your custom module

webapi.xml

<?xml version="1.0"?>

<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
  <route url="/V1/customers" method="POST">
    <service class="VendorName\ModuleName\Api\AccountManagementInterface" method="createAccount"/>
    <resources>
        <resource ref="anonymous"/>
    </resources>
  </route>
</routes>

You need to define interfaces same as AccountManagementInterface of customer module. I hope it will work. Let me know if you need further help :)

  • Thanks For your Reply, It's show dependency error like "Class ABC\\Customer\\Model\\EmailNotificationInterface does not exist" & once i copy that file from core to my module it's work so this is a right way to do that? – Vishal Bansal Mar 29 '19 at 5:57
  • what do you want to achieve by overriding endpoint? – Ramkishan Suthar Mar 29 '19 at 6:31
  • I have created some custom attribute so i would like to get in response that's why i need to overwrite the above API. Can you please help me to solve this "EmailNotificationInterface does not exist" error? – Vishal Bansal May 13 '19 at 5:38
0

If you want just add some custom data to response, there is no reason to do some overrides. You can archive this with use of extension attributes there I provided an example (about quote item, but for Customer idea should be the same). If you don't know about extension attributes there a good starting point.

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.