3
  • How to call dispatch event for REST API's only in mobile devices.
  • define your event in events.xml in etc/webapi_rest in your custom module. – Ramkishan Suthar Apr 21 '19 at 4:57
2

This can be done by defining events.xml in webapi_rest folder.

Example

vendor/magento/module-quote/etc/webapi_rest/events.xml

Magento is doing the same in quote module for sending mail for specific area REST

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_model_service_quote_submit_success">
        <observer name="sendEmail" instance="Magento\Quote\Observer\Webapi\SubmitObserver" />
    </event>
</config>

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.