This is a perl script that shows how to use the CIPRES REST API to submit jobs and retrieve results.
I. InstallationBefore starting the demo, follow the registration instructions in the CIPRES REST API User Guide to create an account for yourself, login and register an application. Make note of the application ID that is assigned.
The demo runs on windows under Cygwin. If using Windows, install Cygwin. Run the appropriate installer, and choose the packages to install. The package that this demo uses is called LWP (Library for WWW in Perl). Thus, you should make sure that along with all the other Perl packages (which are necesary for compilation and execution of Perl scripts), these three LWP packages are installed as well: perl-LWP: Perl WWW Modules, perl-LWP-Media Types: MME type detection module for Perl, and perl-LWP-Protocol-https: :UserAgent.
You may encounter difficulties with certificate authority validation. To fix this, you can use the LWP library version 6.00 or above. Or look into Net::SSL and how to set the environment variables HTTPS_CA_DIR and HTPPS_CA_FILE. Otherwise, you can take the simple but insecure route that we have used in the demo by putting the following bit of code: $browser->ssl_opts(verify_hostname => 0); prior to the code that sets the user's credentials: $browser->credentials(..)
Use apt-get or cpan to install libwww-perl if it isn't already installed.
Go to the "Code" directory containing "cipres_perl.pl" and run "perl cipres_perl.pl"
The output should look like:
Now checking the directory /Users/anthony/cipres_data/sdk_versions/testdata/pycipres.conf for pycipres.conf Now checking the directory /Users/anthony/pycipres.conf for pycipres.conf Now checking the directory for pycipres.conf Hostname: www.phylo.org What would you like to do? Valid commands are: List Jobs (LJ); Submit Job (S); Delete Job (D); List Results (LR); Download Results (DR); Get Tools (GT); Exit (E)If the login credentials or application ID you supplied in pycipres.conf aren't correct, then when you issue a command that authenticates with the REST API (for example, if you type "LJ" to list your jobs), the demo will prompt you to enter valid credentials.