using magento apis for ecommerce website

风格不统一 提交于 2019-12-12 09:46:35

问题


I am a beginner in magento and am working on creating a website using magento. I have noticed that magento has a good number of apis that expose all of the functionality that I would need to create an ecommerce website. So, I would like to use magento's apis to fetch data, but develop the UI separately without any dependencies on magento. I have found a lot of references that develop the website via magento theming, but not those where the UI is developed in a separate MVC and uses magento purely as service layer. Are there any problems/issues in my approach?

Edit: I have gained a lot of clarity on db performance issue in apis and how external caching can alleviate the issue, but I still don't understand the underwhelming use of magento as a service layer (i.e. fueling the website by using magento's apis), are they any other gotchas?


回答1:


Here is how we overcame slowness in Magento APIs:

  1. Created a Web service provider in J2EE, Spring MVC that acts as a proxy between Magento and end users.
  2. J2EE Web service provider exposes pretty much all the APIs that Magento has but also supports JSON with REST along with SOAP & RPC.
  3. J2EE Web service provider uses a document based database (MongoDB) to store a snapshot of product catalog in MongoDB.
  4. J2EE Web service provider uses native MongoDB caching to serve data fast without running any expensive SQL queries.
  5. To avoid dirty caching issues we created a hook in Magento Admin to push data into MongoDB whenever data changes in Magento.

This might sound like overkill to some but we have been able to achieve pretty high throughput without any slowness.




回答2:


The Magento APIs are slow, you would encounter serious performance issues trying to run a site off of it.

Due to the complex nature of the EAV model, you may find it difficult to manage products through the API alone.

Are there any particular concerns you have about using Magento's own frontend? It is daunting at first but once you understand the layout system it's actually very powerful and customisable.




回答3:


Technically it is possible to run a site only through the API.

The issue you might face is a practical one, instead of spending your time trying to learn all the API calls, you can learn how to implement your current UI in Magento.

The advantage to this approach is that you will also better understand how Magento works internally, thus allowing you to leverage it's functionality for your unique business needs.

Another issue is that when using API's you have a little less control over how things are processed / calculated, vs when working in Magento itself there is a lot of control over specifics.




回答4:


I regularly see "session expiration" issues when accessing Magento's API, through both SOAP and XMLRPC. All my calls require exception handling to avoid halting execution. I imagine that alone would create a nightmare when building everything on top of the API.

The best answer you're going to get is to Load Test the API before you start coding. Log the tests extensively and look for errors. If you see errors on a normal basis that should answer your question. Even if you find documentation that says it's okay to do what you're trying, you're still going to have to tune the API to work properly under the load required to run the store.

It will be good to know what you're up against before sinking hours into development.



来源:https://stackoverflow.com/questions/12640491/using-magento-apis-for-ecommerce-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!