Magento 2.3 – How to Overwrite Customer Registration REST API

apimagento2rest

Any once please help me out for overwrite the REST api in magento 2.3 please describe with example.

Best Answer

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 :)

Related Topic