DuraCloud Release 1.2 : REST API Examples Using curl
This page last changed on Sep 30, 2011 by bbranan.
Convenience VariablesThe curl commands below can be used directly if you define the following variables in your shell host=<duracloud-hostname> space-0=<any-name> space-1=<any-name> user=<username> pword=<password> file=<any-file-name> DuraStore NotesThe curl commands in the DuraStore section expect a test file for uploads. echo hello > ${file} Note that if the target of a content or space retrieval (GET) has access permissions set to "OPEN", then the "-u" option in the curl commands is not required. DuraStoreGet Storescurl -u ${user}:${pword} https://${host}/durastore/stores Get Spacescurl -u ${user}:${pword} https://${host}/durastore/spaces curl -u ${user}:${pword} https://${host}/durastore/spaces?storeID=1 Create Spacecurl -u ${user}:${pword} -X PUT https://${host}/durastore/${space-0} curl -u ${user}:${pword} -H "x-dura-meta-city: arlington" -H "x-dura-meta-state: va" -X PUT https://${host}/durastore/${space-1}?storeID=1 Store Contentcurl -u ${user}:${pword} -T ${file} https://${host}/durastore/${space-0}/test.txt curl -u ${user}:${pword} -T ${file} https://${host}/durastore/${space-0}/item.txt Get Spacecurl -u ${user}:${pword} https://${host}/durastore/${space-0} curl -u ${user}:${pword} https://${host}/durastore/${space-1}?storeID=1 curl -u ${user}:${pword} https://${host}/durastore/${space-0}?prefix=test Set Space Propertiescurl -u ${user}:${pword} -H "x-dura-meta-country: usa" -X POST https://${host}/durastore/${space-0} Get Space Propertiescurl -u ${user}:${pword} -I https://${host}/durastore/${space-0} curl -u ${user}:${pword} -I https://${host}/durastore/${space-1}?storeID=1 Get Contentcurl -u ${user}:${pword} https://${host}/durastore/${space-0}/test.txt curl -u ${user}:${pword} https://${host}/durastore/${space-0}/test.txt?storeID=0\&attachment=true Set Content Propertiescurl -u ${user}:${pword} -X POST -H "x-dura-meta-color: green" https://${host}/durastore/${space-0}/test.txt Get Content Propertiescurl -u ${user}:${pword} -I https://${host}/durastore/${space-0}/test.txt Delete Contentcurl -u ${user}:${pword} -X DELETE https://${host}/durastore/${space-0}/test.txt Delete Spacecurl -u ${user}:${pword} -X DELETE https://${host}/durastore/${space-0} curl -u ${user}:${pword} -X DELETE https://${host}/durastore/${space-1}?storeID=1 DuraService NotesThe commands in the DuraService section below demonstrate the deployment, inspection, reconfiguration, and undeployment of a service. bitintegrity=0 deployment=<determined-by-inspection> The following two service configuration files are provided for deployment and reconfiguration of the Bit Integrity Checker. DuraServiceGet Servicescurl -u ${user}:${pword} https://${host}/duraservice/services curl -u ${user}:${pword} https://${host}/duraservice/services?show=deployed Deploy Servicecurl -u ${user}:${pword} -X PUT -T deploy.xml https://${host}/duraservice/${bitintegrity} Get Servicecurl -u ${user}:${pword} https://${host}/duraservice/${bitintegrity} Get Deployed Servicecurl -u ${user}:${pword} https://${host}/duraservice/${bitintegrity}/${deployment} Get Deployed Service Propertiescurl -u ${user}:${pword} https://${host}/duraservice/${bitintegrity}/${deployment}/properties Update Service Configurationcurl -u ${user}:${pword} -X PUT -T deploy-new.xml https://${host}/duraservice/${bitintegrity} UnDeploy Servicecurl -u ${user}:${pword} -X DELETE https://${host}/duraservice/${bitintegrity}/${deployment} DuraReportGet Latest Storage Reportcurl -u ${user}:${pword} https://${host}/durareport/storagereport Get Storage Report Listcurl -u ${user}:${pword} https://${host}/durareport/storagereport/list Get Storage Report Infocurl -u ${user}:${pword} https://${host}/durareport/storagereport/info Start Storage Reportcurl -u ${user}:${pword} -X POST https://${host}/durareport/storagereport Stop Storage Reportcurl -u ${user}:${pword} -X DELETE https://${host}/durareport/storagereport Schedule Storage Report (to begin Jan 1, 2020 at 01:01:01 and repeat every 10 min)curl -u ${user}:${pword} -X POST https://${host}/durareport/storagereport/schedule?startTime=1577840461000\&frequency=600000 Cancel Storage Report Schedulecurl -u ${user}:${pword} -X DELETE https://${host}/durareport/storagereport/schedule Get Deployed Services Reportcurl -u ${user}:${pword} https://${host}/durareport/servicereport/deployed Get Completed Services Reportcurl -u ${user}:${pword} https://${host}/durareport/servicereport Get Services Report Listcurl -u ${user}:${pword} https://${host}/durareport/servicereport/list |
![]() |
Document generated by Confluence on Dec 14, 2011 18:53 |