Using visualizations
Visualizations display data from BIRT documents and BIRT data objects. The REST API accesses visualizations using the /visuals resource. The /visuals resource can export visualizations to documents and spreadsheets for download, or access them directly for web and mobile applications. You can also access the data displayed in a visualization and pass that data to another application. Accessing the data provides the application developer with the ability to present the data visually in any required format.
Most visuals requests use a unique file ID number obtained by the /files and
/folders resources to access RPTDESIGN or RPTDOCUMENT files. Requests that use the /visuals resource can generate content from dynamic data sources, schedule recurring jobs, and convert a report document to different file formats. The /visuals resource can access the contents of a rich visualization including formatted data, bookmarked objects, and parameters. The /visuals resource can also create more rich visualizations from existing executables on a scheduled or immediate basis.
The following sections provide an example of using each visuals resource as a curl command and detailed information about the response returned by the resource.
GET visuals/{visualId}/bookmarks
The following URI requests the bookmarks from the file with file ID 580000000100 when accompanied by a GET method:
GET /ihub/v1/visuals/580000000100/bookmarks HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests the bookmarks from the file with the file ID 580000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/580000000100
/bookmarks ‑H "AuthId:%RESTAuthId%"
GET visuals/{visualId}/bookmarks/{bookmarkName}
The following URI requests the content referenced by the bookmark Revenue Table from the file with file ID 580000000100 when accompanied by a GET method:
GET /ihub/v1/visuals/580000000100/bookmarks/Revenue%20Table HTTP
/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests content referenced by the bookmark Revenue Table from the file with the file ID 580000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/580000000100
/bookmarks/Revenue%20Table ‑H "AuthId:%RESTAuthId%"
GET visuals/{visualId}/datasets
The following URI requests the datasets from the file with file ID 650000000100 when accompanied by a GET method:
GET /ihub/v1/visuals/650000000100/datasets HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests the datasets from the file with the file ID 650000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/650000000100
/datasets ‑H "AuthId:%RESTAuthId%"
GET visuals/{visualId}/datasets/{datasetName}
The following URI requests the Employee Information data set from the file with file ID 650000000100 when accompanied by a GET method:
GET /ihub/v1/visuals/650000000100/datasets/Employee%20Information HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests the Employee Information data set from the file with the file ID 650000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/20100000100
/datasets/Employee%20Information ‑H "AuthId:%RESTAuthId%"
POST visuals/{visualId}/execute
This example sends a request to iHub to run the report design with the file ID 100000000100 and save the document to /Sales/myOutput.rptdocument:
POST /ihub/v1/visuals/100000000100/execute?saveOutputFile=true HTTP/1.1
Host: myserver.mycompanyname.com:5000
Content-Type: application/x-www-form-urlencoded
 
authId=<authId>&saveOutputFile=True&requestedOutputFile=/Sales
/myOutput.rptdocument&paramValues={ "ParameterValue" : [{"Name" : "param1","Value": "3"},{"Name" : "param2","Value": "33"},{"Name" : "param3","Value": "331"},{"Name" : "parama","Value": "32"},{"Name" : "paramb","Value": "321"}]}
This curl example sends a POST request to iHub to run the report design with the file ID 100000000100 and save the document to /Sales/myOutput.rptdocument in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/100000000100
/execute ‑X POST ‑H "AuthId:%RESTAuthId%" ‑d saveOutputFile=true ‑d requestedOutputFile=/Sales/myOutput.rptdocument ‑d paramValues={ \"ParameterValue\" : [{\"Name\" : \"param1\",
\"Value\": \"3\"},{\"Name\" : \"param2\",\"Value\": \"33\"},
{\"Name\" : \"param3\",\"Value\": \"331\"},{\"Name\" :
\"parama\",\"Value\": \"32\"},{\"Name\" : \"paramb\",\"Value\": \"321\"}]}
POST visuals/{visualId}/schedule/now
This example sends a request to iHub to run a low priority job to convert the report document with the file ID 640000000100 to the output file name
/Sales/Sales Analysis.pdf:
POST /ihub/v1/visuals/640000000100/schedule/now HTTP/1.1
Host: myserver.mycompanyname.com:5000
Content-Type: application/x-www-form-urlencoded
 
authId=<authId>&fileType=rptdocument&outputFileName=/Sales
/Sales%20Analysis&outputFileFormat=pdf&priority=100
This curl example sends a POST request to iHub run a job to convert the report document with the file ID 640000000100 to a PDF file in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/640000000100
/schedule/now ‑X POST ‑H "AuthId:%RESTAuthId%" ‑d fileType=rptdocument ‑d outputFileName="/Sales
/Sales Analysis" ‑d outputFileFormat=pdf ‑d priority=100
POST visuals/{visualId}/schedule/once
This example sends a request to iHub to schedule a report job to run the report design identified by the file ID number 640000000100 once at 8:45 p.m. exactly:
POST /ihub/v1/visuals/640000000100/schedule/once HTTP/1.1
Host: localhost.com:5000
Content-Type: application/x-www-form-urlencoded
 
authId=<authId>&priority=1000&fileType=rptdesign&outputFileName=
crosstab&outputFileFormat=rptdocument&scheduleTime=20%3A45%3A00
This curl example sends a POST request to iHub to run the report design with the file ID 640000000100 as a job at 8:45 p.m. on the current day and save the output as a rptdocument file in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/640000000100
/schedule/once ‑X POST ‑H "AuthId:%RESTAuthId%" ‑d fileType=rptdesign ‑d outputFileName="crosstab" ‑d outputFileFormat=rptdocument ‑d scheduleTime="20:45:00"
POST visuals/{visualId}/schedule/recurring
This example sends a request to iHub to run the report design with the file ID 640000000100 every week on Monday and Thursday at midnight from January 1, 2014 to December 31, 2014:
POST /ihub/v1/visuals/640000000100/schedule/recurring HTTP/1.1
Host: myserver.mycompanyname.com:5000
Content-Type: application/x-www-form-urlencoded
AuthId: <authId>
 
fileType=rptdesign&outputFileName=/Sales
/Revenue%20History%20by%20Product%20Line&outputFileFormat=
RPTDOCUMENT&frequency=Weekly&scheduleDay="Mon,Thu"&scheduleTime=00%3A00%3A00&startDate=2014-01-01&endDate=2014-12-31
This curl example sends a POST request to iHub to run the report design with the file ID 640000000100 as a job at midnight every Monday and Thursday from January 1, 2014 through December 31, 2014 and save the output as a .rptdocument file in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/640000000100
/schedule/recurring ‑X POST ‑H "AuthId:%RESTAuthId%" ‑d 
fileType=rptdesign ‑d outputFileName="/Sales/Revenue History by
 Product Line" ‑d outputFileFormat=RPTDOCUMENT ‑d frequency
="Weekly" ‑d scheduleDay="Mon,Thu" ‑d scheduleTime="00:00:00" ‑d startDate=2014-01-01 ‑d endDate="2014-12-31"
GET visuals/{visualId}/parameters
The following URI requests the parameters from the file with file ID 940000000100 when accompanied by a GET method:
GET /ihub/v1/visuals/940000000100/parameters HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests the parameters from the file with the file ID 940000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/940000000100
/parameters ‑H "AuthId:%RESTAuthId%"
GET visuals/{visualId}/parameters/picklist
The following URI requests the parameter picklist for the parameter pCustomer from the file with file ID 430000000100. pCustomer is in the cascading parameter group Customer Selection. The value of the preceding parameter in the group, pCountry, is Canada:
GET /ihub/v1/visuals/430000000100/parameters
/picklist?cascadingGroupName=Customer%20Selection&paramName=
pCustomer&precedingParamValues={"ParameterValue":[{"Name":
"pCountry","Value":"Canada"}]}&fileType=RPTDESIGN HTTP/1.1
 
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests the parameter picklist for the parameter pCustomer from the file with the file ID 430000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/430000000100/parameters/picklist ‑G ‑H "AuthId:%RESTAuthId%" ‑d cascadingGroupName="Customer%20Selection" ‑d paramName="pCustomer" ‑d precedingParamValues="{
\"ParameterValue\" : [{\"Name\":\"pCountry\",\"Value\":
\"Canada\"}]}" ‑d fileType=RPTDESIGN
GET visuals/{visualId}/pdf
The following URI requests a PDF of the current page from the file with file ID 580000000100:
GET /ihub/v1/visuals/580000000100/pdf HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests a PDF of the current page from the file with the file ID 580000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/580000000100/pdf ‑H "AuthId:%RESTAuthId%"
GET visuals/{visualId}/xlsx
The following URI requests an Excel spreadsheet of the first five pages from the file with file ID 580000000100:
GET /ihub/v1/visuals/580000000100/xlsx?pageRange=1-5 HTTP/1.1
Host: myserver.mycompanyname.com:5000
AuthId: <authId>
This curl example requests an Excel spreadsheet of the first five pages from the file with the file ID 580000000100 in the default volume:
curl -i http://%RESTHost%:5000/ihub/v1/visuals/580000000100/xlsx ‑G ‑H "AuthId:%RESTAuthId%" ‑d pageRange="1-5"