I need to update Magento products using a third party API. What is the best method of doing so. Should I trigger an API call when an event/observer hits on product detail page? There is no OAuth yet, just normal hard coded token.
I see alot of documentation for using MAGENTO's API, but not a third-party API.
Best Answer
first of all you should know working with APIs using PHP, sending requests and parsing responses. And every API has own structure, signature and methods, see your third party API documentation. Using PHP you can call api methods with curl or standard http requests. Here is some tips.
Here is scenario how to update your products data using standard Magento approach:
1. Create custom local module
2. Write your updater model, it uses curl or http request to call to third party api. In this model you should implement all methods which is required to interconnect the api. To optimal develop architecture of your updater you should know how to use your third party api, read its documentation. For example documentation:
And so on. API documentation gives full scheme of using methods.
Methods of api given above are implemented in the your custom Model:
And finally you should schedule some cronjob to update products every x time in your config.xml:
P.S I didn't test the code given above, I try to describe how to using API to update products. Thanks.