asbjorn Posted May 8, 2017 Share Posted May 8, 2017 Has anyone integrated Directus with ProcessWire? I have a database in Directus that I want to sync with ProcessWire (create/update/delete pages). But I don't not know where to start. It might be possible with ProcessWire's API in some way? Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 9, 2017 Share Posted May 9, 2017 Will this be a one-off task or some continuous syncronization? What's you specific need? Integrating with directus should not be a problem, especially as they offer a php sdk. Link to comment Share on other sites More sharing options...
asbjorn Posted May 15, 2017 Author Share Posted May 15, 2017 The one-off task was rather easy, and I have managed this using the php sdk as you mention. But I'm not sure about how to go further, setting up a continuous synchronization. One-way, from Directus to ProcessWire. I'm new to this way of thinking (working with APIs). Should I use «cron jobs» of some sort? Or rely on Directus «pushing» when something is updated? Any good ideas are welcomed. Maybe this post could also be a heads up to others who are new to this … Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 15, 2017 Share Posted May 15, 2017 The question is why do you sync data anyways? You could load it from directus anytime you need it. Link to comment Share on other sites More sharing options...
asbjorn Posted May 16, 2017 Author Share Posted May 16, 2017 I still have the need for ProcessWire to create a page for each item in Directus database. And be able to update the title if the item changes. And also I would prefer to keep working with the ProcessWire API, because of the way the end point for this import («person pages») is integrated with the rest of the website. Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 16, 2017 Share Posted May 16, 2017 I'd really suggest you to sort out why you need to have data in multiple places (especially edit them in multiple places). Keeping things in sync is a task, where so many things can go wrong, that it's often the better solution to keep things in one place. If you really need to sync stuff, one way sync (essentially caching) is the simple option, because you can just discard anything on the receiving end without worrying to overwrite any changes (especially useful if something did went wrong and you need to fix that). Two way sync is the hard part, especially as you need to handle things like potential downtime of both services, network issues, missed updates and so on. 1 Link to comment Share on other sites More sharing options...
asbjorn Posted May 16, 2017 Author Share Posted May 16, 2017 This will be a one-way sync (as I mentioned in my second post in this thread). The data will only be updated in the Directus database. No editing on these data will be done in ProcessWire. Also said, but in other words: When the data is imported (to ProcessWire) and kept updated/synced, I will be able to use the ProcessWire API to handle the data as per today. Meaning no extensive recoding of templates and so. Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 16, 2017 Share Posted May 16, 2017 Then it depends on directus how you keep things in sync. Either you trigger the sync in intervals or manually, where you simply recreate all pages, which have been updated in directus since the previous sync. Or directus does support some mechanism to trigger external things, if someone does update content. Link to comment Share on other sites More sharing options...
Recommended Posts