I am currently developing a custom Magento extension (Magento CE 1.7) that will use the Magento observers, to send data back to a custom ERP solution when certain events are triggered.

However, this ERP solution also uses the Magento SOAP API to update information back to the website (two-way syncing system).

My question is, in my Magento Observer, how can I tell if the following events are being triggered by the Magento SOAP API calls from the ERP versus user interaction in the frontend/backend of the website?

Events I would like to check if being called via API:

  • sales_order_save_after
  • catalog_product_save_comit_after

I have searched all of the SO boards and seen several similar questions, however none of them appear to have been answered.

Thank you ahead of time!


1 Answer 1


I ended up going this way;


class My_Module_Model_Observer {

    protected $apiCall;

    public function __construct()
        $request = Mage::app()->getFrontController()->getRequest();

        $this->apiCall = false;
        if (
            stripos($request->getRequestUri(), '/api/')
        ) {
            $this->apiCall = true;

And then check for if ($this->apiCall) {} in my method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.