1

My team and I are building a Magento website for a client and we need to regularly perform data exports from another server to the Magento server.

I'd like to call a custom admin action from another server to start the import of a file sent via FTP on the Magento server.

  • How can I remotely access to Admin actions ?
  • Should I use cURL and the admin URL, customized magento SOAP API or REST API requests ?

I've never used any of the above (I've used Magento SOAP API but I haven't customized it), so please mind to redirect me to tutorials or explain thoroughly.

PS : I thought of using Cron job to import regularly (night time), but then I'd need to be sure the cron is launched after the FTP transfer (in case of slow connection) and that the server has the last version (stamped with current date). Is there a way to postpone a cron job without modifying the original ? Like a Magento way to say "sleep(15minutes)" to a cron job, or maybe should I check within my scrip and use "sleep()" until file is uploaded and updated ? (I would cancel the import and notify an admin after X hours of postponing)

1
  • Is using the cron job a good alternative to remote access for my problem ? Knowing that I'd execute the script from a remote server to analyze the return of the action and notify an admin with the server's scripts in case of problem. Though i'd still appreciate to know a way to access admin actions from a remote server for further features or random internet users looking for an answer to this question.
    – Strannch
    Commented Jan 11, 2016 at 8:18

1 Answer 1

2

In my opinion, calling admin controllers from remote seems weird. In general, I'd use a cronjob on the Magento server which regularily polls a directory for new files. The files should then be processed, typically you'd use a custom model in a module for that. For import, I suggest a tool which can be called from anywhere, like Avs_FastSimpleImport (disclaimer: my module), ApiImport by Daniel Sloof or uRapidFlow. Read the data from the file, transform it to the necessary array format and import it with the tool.

1
  • Yeah, i think after some time of thinking and having more info about what we needed, i chose to go with the cron and handmade import system. Thanks though for pointing in the right direction
    – Strannch
    Commented Jan 15, 2016 at 16:21

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.