1

We have been using the Magento Rest API to communicate between external systems and Magento. Painfully, we have discovered that the REST API does not scale well. Specifically, often times requests time-out when requesting large amounts of data (say, about fifty products). We are using version 1.7.0.2.

One solution we are investigating is creating a custom API not written using Magento for the purpose of reading/writing into Magento.

  • Is this a solution typically used?
  • If so, any packages that simplify read/write operations from Magento EAV tables?
  • If not, are there any ways to speed up the Magento REST API?

We are in the process of scaling and speed is very important to us.

2 Answers 2

1

I'm not a fan of connecting to the a database at all. If someone gets hold of the credentials, because your code has a security leak or anything, anyone could read all data in the database, including customer data and creditcard data (if you save that). That's something you really don't want.

Did you look at extensions like uRapidflow or AvS_FastSimpleImport, which are Magento extensions that work really fast for importing data into Magento. The only thing you might have to do is write a custom layer which will fetch (or write) the data to the Magento server and make it usable for one of these extensions.

I know it's a completely different approach, but I think it's a much safer and more useful approach then connection directly to the database.

2
  • Hey Arjen, thanks for your reply. When it comes to security, we can whitelist the API to communicate with the Magento database directly without posing a security risk. Thank you for the two extension you listed - I already started looking into them and they seem quite intriguing. I have two concerns about these: 1) our API will need to also modify other data models in addition to products such as customer attributes and 2) our API will need to be fast and get a response in real time. I am not entirely sure the CSV approach will work here since it seems to rely on background job processing. Apr 6, 2017 at 16:08
  • @dipole_moment this still makes the database accessible from the outside world, which I would recommend to avoid in as many cases as possible. You only need one person who loses the credentials and you're screwed. About realtime response, I'd suggest to have some kind of API script on your API's side which can be called to from Magento. And then use one of the extensions I mentioned for syncing stuff in the background, like products. Apr 10, 2017 at 6:38
0

This solution can be used.
Make additional api and write your queries there, you can use same db adapter or write your own queries, you just need to be precise when writing the query and insure that you are only reading and publishing the data needed.
Internally magento also generating queries and executing on database to populate the result. This will give you some better performance and less timeout errors.
But make queries wisely.

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.