1

I have a Shopify App and am willing to port it to Magento. Given a running Magento ecommerce URL, is there a way to:

  • Retrieve a [token / OAuth] to access the data from Magento using a RESTFul / SOAP / Whatever way?
  • Using Magento exposed API, register an external URL as a webhook endpoint to receive notifications whenever an Order gets created or when a Product gets created / updated / destroyed?
  • If both things are possible, how do you take care of all those different Magento versions?
Doodloo
  • 869
  • 5
  • 18

1 Answers1

0

Retrieve a [token / OAuth] to access the data from Magento using a RESTFul / SOAP / Whatever way?

Yes. The REST API in Magento uses an OAuth authentication process and provides the endpoints required to get tokens, etc.

Using Magento exposed API, register an external URL as a webhook endpoint to receive notifications whenever an Order gets created or when a Product gets created / updated / destroyed?

No. Magento incorporates event driven architecture (EDA), so the best way to provide data to your external endpoint would be to create an observer in Magento, connect it to whichever event you want to monitor (for example, sales_order_place_after for new orders) and use the observer to send the data to your external endpoint.

Technically what you asked is possible, but you would need to implement it yourself using a custom made API endpoint that registers new observers following the observer pattern mentioned above.

If both things are possible, how do you take care of all those different Magento versions?

I'm not sure I understand this question, but when you start using Magento you will choose a version to use. Obviously you should choose the latest version of either Magento 1 or 2 to use since it will be the most secure and up-to-date in terms of functionality and security patches, however the main question for you is whether you want to use Magento 1 or Magento 2. There are plenty of comparisons online about this, but I'd suggest you go with Magento 2 purely because Magento 1 will be deprecated in a couple of years time.

Community
  • 1
  • 1
scrowler
  • 24,273
  • 9
  • 60
  • 92
  • I'm going to clarify my question. We don't own any Magento instance. We are currently providing services as a Shopify App. When the user installs the app in his store, the app talks with our API. Our API registers itself for receiving events (We are not running code by Shopify, such thing doesn't exist). We would like to provide the same level of service to existing Magento users, hence my question "How do you support all versions". We would like to have our API register itself as an endpoint for Orders / Products. We don't plan to "start using Magento", our customer use Shopify and Magento. – Doodloo Aug 05 '16 at 18:16
  • Hi @Doodloo - your clarification doesn't change the points in my answer. Magento dispatches events that you define within Magento, it doesn't have the ability to register events from external vendors out of the box. – scrowler Aug 08 '16 at 21:30
  • I think I get it: you're basically suggesting for us to create a Magento extension that will augment Magento functionality, correct? But in that case, the problem is shifted: once someone gives us authorization using OAuth, how do we hit his magento instance to install our extension automatically? – Doodloo Aug 10 '16 at 16:09
  • Yes that's exactly right. Re: new question - yo don't do that. Customers would need to install your module themselves. Possibly not the best soliton for the job? – scrowler Aug 10 '16 at 18:32
  • Re: Not the best solution, but at least a solution. To recap: we would first need to get an OAuth token from the customer's Magento instance. Then we'd have to instruct him to install an extension. Sounds like a good solution. Maybe the first step could automatically be took care of by the extension. Will look into that. – Doodloo Aug 15 '16 at 10:51
  • Definitely. Good luck – scrowler Aug 15 '16 at 10:58