This tutorial quickly introduces the basics of the CIPRES REST API (aka, the CRA). It shows how to access the API with the standard unix "curl" command from Unix, Linux or a MacOS terminal window. Please refer to the User Guide for a more in-depth explanation and description of the many options that are available.
If you aren't familiar with curl, google "curl" or run "man curl".
The examples in this tutorial assume you've set the following environment variables:
$ export URL=${rest_url}
$ export CRA_USER=your_cra_username
$ export PASSWORD=your_cra_password
$ export KEY=your_application_ID
$ curl -u $CRA_USER:$PASSWORD -H cipres-appkey:$KEY $URL/job/$CRA_USER -F tool=RAXMLHPC8_REST_XSEDE -F input.infile_=@./raxml_inputphy.txt -F metadata.statusEmail=trueReferring to the command above (and possibly the curl man page), you'll notice that:
jobstatus.selfUri.url
, gives the job's url. You can use this url to to poll for updated
status and find out when the job has finished (if you didn't set metadata.statusEmail=true).
You'll know the job is finished when jobstatus.terminalStage = true
.
$ curl -u $CRA_USER:$PASSWORD -H cipres-appkey:$KEY jobstatus.selfUri.url
Be sure to substitute the actual value of jobstatus.selfUri.url
from the returned XML jobstatus object
when you run this command. It will look something like ${rest_url}/job/username/NGBW-JOB-RAMLHPC8_REST_XSEDE-nnnn.
jobstatus.resultsUri.url
:
$ curl -u $CRA_USER:$PASSWORD -H cipres-appkey:$KEY jobstatus.resultsUri.urlThis returns an XML results object which contains a sequence of "jobfile" objects. Each jobfile has a URL given by
jobfile.downloadUri.url
that can be used to download the file:
$ curl -u $CRA_USER:$PASSWORD -H cipres-appkey:$KEY -O -J jobfile.downloadUri.url
$ curl -u $CRA_USER:$PASSWORD -H cipres-appkey:$KEY $URL/job/$CRA_USERThis returns a sequence of abbreviated jobstatus objects. Use the
jobstatus.selfUri.url
member of any of the abbreviated jobstatuses to
retrieve the full jobstatus.
$ curl -u $CRA_USER:$PASSWORD -H cipres-appkey:$KEY -X DELETE jobstatus.selfUri.urlNothing is returned from a successful DELETE operation. You can verify that the job was deleted by trying to delete it again or by trying to get its status. A 404 NOT FOUND status should be returned along with an XML error object with displayMessage = "Job Not Found."