GetExecute allows you to execute reports in the API, without opening an instance of Exago. If executing as text, i.e. Html, Csv, or Json, then the output data is returned directly in the ExecuteData property. If executing as binary, i.e. Pdf, Rtf, or Excel, then ExecuteData returns a URL string in the following format:
ExecuteExport.aspx?{parameters}
To download the output data, append the URL to the end of your Exago base URL and launch the full URL string in a browser:
http://{yoursite}/{exago}/{ExecuteExportUrl}
The string is one-use only. To re-download the file, you must create a new Export Url.
Note. All requests require Session Id URL parameter and basic request headers. In the following examples, headers are omitted for clarity.
The path to the report is passed as part of a JSON object, with optional sorts and filters. Any sorts and filters are added only for this execution, and do not persist throughout the session.
Name | Type | Writeable | Description |
ReportPath | string | required | Full path from the root folder to the report |
Sorts | array of Sort | yes | Any sorts to apply to the report during execution |
Filters | array of Filter | yes | Any filters to apply to the report during execution |
POST /reports/execute/{Type}
Type indicates which format you want to receive the output data, html, csv, pdf, rtf, excel, json.
curl http://{webservice}/rest/reports/execute/csv?sid={sid} -X POST ^
-d "{'ReportPath':'Inventory\\Products'}"
Note. Windows file paths are delineated by double-backslashes: \\
GetExecute returns the following JSON object:
Name | Type | Description |
ReportPath | string | Full path from the root folder to this report |
ExportType | string | Format of export data |
DataType | string | "Data" for text-based formats; "Url" for binary formats |
ExecuteData | string | For text-based formats, the report output data; For binary formats, the Execute URL to download the data |
IsError | boolean | Whether there were any errors when executing this report |
ErrorList | array of string | If IsError = true, a list of errors encountered when executing this report |
Status: 200 OK { "ReportPath": "Inventory\\Categories", "ExportType": "csv", "DataType": "Data", "ExecuteData": "\"Categories\"\r\n\"Beverages\"\r\n\"Condiments\"\r\n\"Confections\"\r\n\"Dairy Products\"\r\n\"Grains/Cereals\"\r\n\"Meat/Poultry\"\r\n\"Produce\"\r\n\"Seafood\"\r\n", "IsError": false, "ErrorList": null }
Each run-time sort is supplied using the following JSON object:
Name | Type | Writeable | Description |
EntityName | string | required | Data object to sort on |
ColumnName | string | required | Column to sort on |
AscendingFlag | boolean | yes (false) | Whether to sort in ascending (versus descending) order |
Each run-time filter is supplied using the following JSON object:
Name | Type | Writeable | Description |
EntityName | string | required | Data object to filter on |
ColumnName | string | required | Column to filter on |
DataType | enum | yes ("string") | Data Field Type |
Operator | enum as integer | yes (0) | Filter Operator Type (only accepts integer value) |
Values | array of string | yes | Values to filter with |
POST /rest/reports/execute/{Type}
Type indicates the format you want to receive the output data, html, csv, pdf, rtf, excel, json.
curl http://{webservice}/rest/reports/execute/csv?sid={sid} -X POST ^ -d @reportExecuteResource.txt
reportExecuteResource.txt
"{ 'ReportPath': 'Inventory\\Categories', 'Sorts': [ { 'EntityName': 'Categories', 'ColumnName': 'CategoryName', 'AscendingFlag': false } ], 'Filters': [ { 'EntityName': 'Categories', 'ColumnName': 'CategoryName', 'DataType': 'string', 'Operator': 14, 'Values': [ 'Beverages', 'Produce', 'Seafood' ] } ] }"
Status: 200 OK { "ReportPath": "Inventory\Categories", "ExportType": "csv", "DataType": "Data", "ExecuteData": "\"Categories\"\r\n\"Seafood\"\r\n\"Produce\"\r\n\"Beverages\"\r\n", "IsError": false, "ErrorList": null }