bluellyr Posted March 6, 2019 Share Posted March 6, 2019 Hi, I have a project that will be necessary to export/import and create/update pages and fields using the API without the end user action: - It is possible to export pages or fields to a file and save that file using the Processwire API? - It is possible to import pages or fields from a local or remote file (previous exported from other Processwire) using the Processwire API? - It is possible to update pages or fields from a file using the Processwire API? - Can the export/import functionalities give any help addressing these issues or it is necessary create all these functionalities from scratch? Thank you and hoping to have your feedback. Link to comment Share on other sites More sharing options...
kongondo Posted March 6, 2019 Share Posted March 6, 2019 In a hurry, so answering quickly.. 1 hour ago, bluellyr said: It is possible to export pages or fields to a file and save that file using the Processwire API? Yes. For fields and templates have a look at the method setImportData(). For pages, there's different ways. I'll let others chime in. Exporting pages example. 1 hour ago, bluellyr said: It is possible to import pages or fields from a local or remote file (previous exported from other Processwire) using the Processwire API? Yes, for pages, using previously exported JSON or ZIP and for fields using previously exported JSON and setImportData(). Examples of importing fields and templates from JSON. 1 hour ago, bluellyr said: It is possible to update pages or fields from a file using the Processwire API? Yes. How you do it depends on the fieldtype... (others will chime in here) 1 hour ago, bluellyr said: Can the export/import functionalities give any help addressing these issues or it is necessary create all these functionalities from scratch? Not sure I understand this fully, but yes, you can do everything from the API or using the GUI. For pages, the PagesExportImport is still experimental but it works fine (for me). 2 Link to comment Share on other sites More sharing options...
Autofahrn Posted March 7, 2019 Share Posted March 7, 2019 Sorry to say, but when you intend to migrate fields between installs be aware that the GUI import/export functions rely on ids rather than names. If the target is not 100% in sync with the source, you may end up correcting things in the database. This is particular true when it comes to Repeaters and the RepeaterMatrix. ...and do Option fields restore options properly when importing an exported page? Until now I preferred to do this via API and run my own, application specific implementation. 2 Link to comment Share on other sites More sharing options...
bluellyr Posted March 15, 2019 Author Share Posted March 15, 2019 @kongondo thank you for your time and for your reply. It gave me a lot of to dig into. Many thanks for the links and examples. Link to comment Share on other sites More sharing options...
bluellyr Posted March 15, 2019 Author Share Posted March 15, 2019 @Autofahrn Yes that is one of my concerns. The first approach to the implementation of the structure was to have a parent Processwire installation and to have some other children Processwire installations that in some how will mirror the structure of the parent (templates and fields). The templates and fields were not be edited on the children only the pages. For the pages we needed other process to maintain everything synchronised. But this scenario is really difficult to maintain and synchronise and we have dismiss this approach and we are going to a central Processwire installation with an API and each child can CRUD using the API. We will need import/export functionality but with less or none uncertainties on the process since they will be executed on the central installation. Thank you Link to comment Share on other sites More sharing options...
Autofahrn Posted March 15, 2019 Share Posted March 15, 2019 Indeed, sounds complicated. But since you can do anything using the PW API, I don't see a reason why this shouldn't work with a custom solution. But there probably is no module which could be used out-of-the-box. Link to comment Share on other sites More sharing options...
Robin S Posted March 15, 2019 Share Posted March 15, 2019 6 hours ago, bluellyr said: The first approach to the implementation of the structure was to have a parent Processwire installation and to have some other children Processwire installations that in some how will mirror the structure of the parent (templates and fields). Sounds like the Multisite module could be a contender: https://github.com/somatonic/Multisite/ And you'll want to read the support thread to get an idea of the current status of the module: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now