You are not logged in.
Pages: 1
I am thinking of a side project involving FormBuilder, but not sure how to organize it.
The aim is to produce a json export of form submissions, given a date range. In the ideal scenario, the form in question would be located via the page it is included in.
Much of this code is ready in command-line form. But what is the right place to install it? Would I have to patch FormBuilder, or should I make a custom class?
Related questions:
What would be a good URL for this sort of endpoint? E.g. for http://example.com/admin/pages/edit/1/ it would be nice to have a predictable json URL.
Is there a way to log in to admin from the command line? It would be great to script this sort of thing with e.g. curl.
Best,
Tushar
Offline
I'd probably not extend Form Builder directly since it could possibly be overwritten by a future Form Builder extension update. I'd add a new module or just some scripts in /custom/admin/ajax/.
Unfortunately there's no way to use the default authentication over the command line so if that's a requirement you'll probably want to put the scripts in /templates/ajax/ instead and use a secret key for authentication over the command line.
Offline
Thanks!
By secret key (for the templates/ajax way), do you mean an ssh key? Or logic in the script to check a key?
Offline
Just logic in the script - an example would be generating a 32 character random string that only your command line and the AJAX script know. You could also add additional security by checking if it's being run by command line, e.g.
if (PHP_SAPI !== "cli") {
die("Must be called via terminal or cron.");
}
Offline
Sounds great, thank you! Tushar
Offline
Pages: 1