Hi. We're creating a module for our Magento 2.3 installation. This module will get some information from Magento and send it somewhere else through API.
What I want to ask is what is the recommended way to get information from magento. Is it fine to do it through REST API in your code? Or should it be done somehow else? Are there any examples that show the best way to do this in Magento?
Another question, how do we run our module after certain actions? For example if we want to run our module right before a purchase is made? Thank you for your help.
Solved! Go to Solution.
I understand the question you have asked !
If you are going to create Magento module then i would say get the information from Magento progrmatically, meaning by using Model and Collection instead of API. Because you will easily get all the information progrmatically.
Later if you would like to send those information to somewhere else then use API
Also if you would like to run your custom module after certain action then you will require to use concept called Event Observer in your module.
So when any event fired (Ex - Purchase order) at that time observer calls your custom module function and its logic
To get to know more information about event observer refer this link -
https://devdocs.magento.com/guides/v2.3/extension-dev-guide/events-and-observers.html
https://www.mageplaza.com/magento-2-module-development/magento-2-create-events.html
Refer this link to get more details about how to create a custom module -
https://www.magestore.com/magento-2-tutorial/magento-2-modules/
Hope it helps !
I understand the question you have asked !
If you are going to create Magento module then i would say get the information from Magento progrmatically, meaning by using Model and Collection instead of API. Because you will easily get all the information progrmatically.
Later if you would like to send those information to somewhere else then use API
Also if you would like to run your custom module after certain action then you will require to use concept called Event Observer in your module.
So when any event fired (Ex - Purchase order) at that time observer calls your custom module function and its logic
To get to know more information about event observer refer this link -
https://devdocs.magento.com/guides/v2.3/extension-dev-guide/events-and-observers.html
https://www.mageplaza.com/magento-2-module-development/magento-2-create-events.html
Refer this link to get more details about how to create a custom module -
https://www.magestore.com/magento-2-tutorial/magento-2-modules/
Hope it helps !