1

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

0

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 at 5:57
  • what do you want to achieve by overriding endpoint? – Ramkishan Suthar Mar 29 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 at 5:38

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.