Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Sonya* Posted May 11 Posted May 11 I would like to use some APIs from other resources to import records into Pages databases. The scenario is: if a user creates a record, a search request should be sent through API to find a match if there is a match, the records fields should be filled with the found item automatically (get request) if there is no match, the record should be created as usual “listen” to the changes of the record through API and update if needed Did somebody create something like this? I absolutely do not want to use any ready apps like Movies, Links, Videos, Books etc. It should be made with a database in Pages. The question is: where to start and how to do it with the least customization? Any ready functions to connect with 3rd party APIs? Services like Zapier are welcome, however not all APIs I would like to use are integrated in Zapier. Ideas? Thanks! Jimi Wikman 1
BN_IT_Support Posted May 29 Posted May 29 Hi, I don't fully understand what you're doing, so this might entirely miss the point 😉 I have never done exactly what you're doing, but we have done something simpler - doing lookup of ZIP to lat/long using various API providers. I think you're going to find that all APIs are different - either because they took short cuts and implemented whatever seemed easiest on the day or else for competitive advantage. Either way, you will find you need to code to multiple different APIs. I would design this with a separate file (possibly 'Source') for each API. Each file would implement an interface for your core - say 'get' and 'search' - and would then implement the API specific stuff such as the actual network/HTTP calls and then reformatting the response to the standard structure used in your core. In this model, Zapier would be just one more file following the same general structure - nothing special. If you have a significant number of API services (files) then the question arises of how to you call them. Do you just hard code it and go round a loop calling each of your 5 to 10 API services in sequence or do you implement a 'discovery process' - similar to what Invision does to discover your extensions so it knows to call them. Obviously, a discovery process is slightly more compute intensive but it can make it easier to manage as you just put your files in a specific folder and they get discovered and called. How do you schedule your code to run? If calling only one service then you could do it as and when the user creates a record as the additional processing time and delay is unlikely to give a bad user experience. But if you have 5 to 10 services then you almost certainly need to queue your processing into the background so the user interface is not delayed. John
Recommended Posts