2

Is there any pre/post dispatch events for the Magento 2 web API (REST/SOAP) ?

Alex Paliarush
  • 13,751
  • 5
  • 51
  • 55
Atish Goswami
  • 5,551
  • 7
  • 34
  • 63

3 Answers3

2

If you want to add something to the response you may want to look into extension_attributes. Here is description in magento docs and here another question on stack

Zefiryn
  • 5,888
  • 2
  • 25
  • 34
1

There are no events in Magento 2 web APIs, but it is possible to extend any public method in the system using befor/after/around plugins. Also see why it is better to use plugins instead of observers.

Alex Paliarush
  • 13,751
  • 5
  • 51
  • 55
0

I don't know maybe this is a dirty way, override this class

Magento\Webapi\Controller\Rest\Router::match()
Ansyori
  • 842
  • 10
  • 18