https://github.com/sppautomation/sppclient
https://github.com/CristieNordic/SpectrumProtectRest
https://github.com/withspectrum/spectrum
RestAPI required a connection using port 443 HTTPS
Check on the SSP web interface to find the api links
post | /api/endeavour/report | Create report |
get | /api/endeavour/report | Find all reports |
get | /categories | Find report categories |
get | /api/endeavour/report/categories/{categoryStr} | Find report category by ID |
get | /api/endeavour/report/engine | Find report engine |
get | /api/endeavour/report/{reportIdStr} | Find report by ID |
put | /api/endeavour/report/{reportIdStr} | Update report by ID |
post | /api/endeavour/report/{reportIdStr} | Perform action on report |
delete | /api/endeavour/report/{reportIdStr} | Delete report by ID |
get | /api/endeavour/report/{reportIdStr}/parameter | Find all report parameters by ID |
get | /api/endeavour/report/{reportIdStr}/parameter/{parameterStr} | Find report parameter by report ID and parameter ID |
get | /api/endeavour/report/{reportIdStr}/parameter/{parameterStr}/values | Find all report cascading parameter values by report ID and parameter ID |
Create a user / password for the restAPI connection
user_pwd=“restapiusr:passw0rd”
sspserver=“https://spectrumPPsrv01”
# curl -sS -k -X POST -H 'Accept:application/json' -H 'Content-type:application/json' --user "${user_pwd}" ${sspserver}/api/endeavour/session | tr ',' '\n' | grep sessionid {"sessionid":"52cc0f08a00a436caeafc76b4bedbeed" # wsessionid=$(echo "x-endeavour-sessionid: 52cc0f08a00a436caeafc76b4bedbeed")
When using at en of line : | jq '.' | egrep “name|displayName|href” | egrep -i “name|run”
# curl -sS -k -X GET -H 'Accept:application/json' -H 'Content-type:application/json' -H "$wsessionid" -H 'x-endeavour-auditrequest:false' ${sspserver}/api/endeavour/report
"name": "Configuration", "displayName": "Configuration", "href": "https://spectrumPPsrv01/api/endeavour/report/1002?action=run", "name": "Protected VMs", "displayName": "Protected and Unprotected VMs", "href": "https://spectrumPPsrv01/api/endeavour/report/1003?action=run", "name": "Protected Databases", "displayName": "Protected and Unprotected Databases", "href": "https://spectrumPPsrv01/api/endeavour/report/1004?action=run",
After selecting a report, check it's parameters:
# curl -sS -k -X GET -H 'Accept:application/json' -H 'Content-type:application/json' -H "$wsessionid" -H 'x-endeavour-auditrequest:false' ${sspserver}/api/endeavour/report/1003?action=run | jq .
{ "links": { "self": { "rel": "self", "href": "https://spectrumPPsrv01/api/endeavour/report/1003", "title": "Protected and Unprotected Databases" }, "up": { "rel": "up", "href": "https://spectrumPPsrv01/api/endeavour/report" }, "customReports": { "rel": "related", "href": "https://spectrumPPsrv01/api/endeavour/report?filter=[{\"property\":\"parentId\",\"value\":\"1003\"}]" }, "parameters": { "rel": "related", "href": "https://spectrumPPsrv01/api/endeavour/report/1003/parameter" }, "schema": { "rel": "related", "href": "https://spectrumPPsrv01/api/endeavour/report/1003/schema", "title": "schema" }, "run": { "schema": "https://spectrumPPsrv01/api/endeavour/report/1003/schema?action=run", "rel": "action", "href": "https://spectrumPPsrv01/api/endeavour/report/1003?action=run", "title": "Run report" } }, "name": "Protected Databases", "displayName": "Protected and Unprotected Databases", "description": "Review the Protected and Unprotected Databases.", "categoryDisplayName": "Protection", "custom": false, "creationTime": 1565277663455, "paramValues": { "ApplicationType": "(All)", "ApplicationServer": [ "(All)" ], "ApplicationServerType": "(All)", "UnprotectedVMs": true, "ShowProtectedVMs": false }, "rbacPath": "root:0/report:0/reportcategory:ProtectionCategoryName/report:1003", "id": "1003" }
Use POST, and you will receive a task ID
# curl -iL -sS -k -X POST -H 'Accept:application/json' -H 'Content-type:application/json' -H "$wsessionid" ${sspserver}/api/endeavour/report/1003?action=run -d '{"NodeCascadingParameterGroup-HypervisorType":["(All)"],"NodeCascadingParameterGroup-Hypervisor":["(All)"],"UnprotectedVMs":"false","OffloadedVMs":"false"}'
{"location":"https://spectrumPPsrv01/api/endeavour/task/1035"}
# curl -sS -k -X GET -H 'Accept:application/json' -H 'Content-type:application/json' -H "$wsessionid" -H 'x-endeavour-auditrequest:false' ${sspserver}/api/endeavour/task/1035 | jq .
{ "links": { "self": { "rel": "self", "href": "https://spectrumPPsrv01/api/endeavour/task/1035", "hreflang": null, "media": null, "title": null, "type": null, "deprecation": null }, "up": { "rel": "up", "href": "https://spectrumPPsrv01/api/endeavour/task", "hreflang": null, "media": null, "title": null, "type": null, "deprecation": null } }, "name": null, "status": "SUCCESS", "type": "run", "source": null, "result": "https://spectrumPPsrv01/api/endeavour/reportInstance/Protected VMs_12-19-2019_15-25-10", "custom": null, "customStatus": null, "initialTime": "1576765509158", "completeTime": "1576765510039", "id": "1035" }
Replace <space> by <%20>
# curl -sS -k -X GET -H 'Accept:application/json' -H 'Content-type:application/json' -H "$wsessionid" -H 'x-endeavour-auditrequest:false' ${sspserver}/api/endeavour/reportInstance/Protected%20VMs_12-19-2019_15-25-10 | jq .
{ "links": { "self": { "rel": "self", "href": "https://spectrumPPsrv01/api/endeavour/reportInstance/Protected%20VMs_12-19-2019_15-25-10", "title": "Protected and Unprotected VMs" }, "delete": { "rel": "delete", "href": "https://spectrumPPsrv01/api/endeavour/reportInstance/Protected%20VMs_12-19-2019_15-25-10" }, "pdf": { "rel": "download", "href": "https://spectrumPPsrv01/api/endeavour/reportInstance/Protected%20VMs_12-19-2019_15-25-10/download/pdf?esessionid=52cc0f08a00a436caeafc76b4bedbeed" }, "excel": { "rel": "download", "href": "https://spectrumPPsrv01/api/endeavour/reportInstance/Protected%20VMs_12-19-2019_15-25-10/download/excel?esessionid=52cc0f08a00a436caeafc76b4bedbeed" }, "view": { "rel": "related", "href": "https://spectrumPPsrv01/api/endeavour/reportInstance/Protected%20VMs_12-19-2019_15-25-10/view/html?esessionid=52cc0f08a00a436caeafc76b4bedbeed", "title": "View" } }, "id": "29", "name": "Protected VMs_12-19-2019_15-25-10", "rbacPath": "root:0/reportinstance:0/reportinstance:29", "fileDate": 1576765510000, "category": "Protection", "reportName": "Protected and Unprotected VMs", "langType": "EN_US"
Here we have 3 reports available: pdf, csv and view (direct link for a web browser)
Download localy the PDF report
# curl -iL -s -k -o report_db.pdf https://spectrumPPsrv01/api/endeavour/reportInstance/Protected%20VMs_12-19-2019_15-25-10/download/pdf?esessionid=52cc0f08a00a436caeafc76b4bedbeed