# Fetch query report data for the specified report ID Retrieves the result data and column metadata for a previously saved query report identified by its ID. The report ID can be obtained from [Retrieve All Query Reports](https://www.manageengine.com/products/desktop-central/help/api/onpremise/report-get-available-query-reports.html). The saved SQL SELECT query is re-executed with the specified pagination parameters and the results are returned. The saved report's reportName is included in the response for identification. ## Endpoint `GET /dcapi/reports/queryReports/{id}/data` ## Request ### Request URL `https://{server-hostname}:8383/dcapi/reports/queryReports/{id}/data` ### Scope `QueryReport.READ` ### Header `Authorization: d92d4xxxxxxxxxxxxx15f52` ### Request Parameters #### Request Headers - **Accept** `string` — **Mandatory** - `application/queryResult.v1+json` #### Path Parameters - **id** `string` — **Mandatory** - The [unique id](https://www.manageengine.com/products/desktop-central/help/api/onpremise/report-get-available-query-reports.html) retrieved for saved query report ### Sample Request ```curl curl --request GET \ --url https://appdomain/dcapi/reports/queryReports/{id}/data \ --header 'Accept: application/queryResult.v1+json' \ --header 'Authorization: d92d4xxxxxxxxxxxxx15f52' ``` ## Response Parameters ### HTTP 200 Response Body — `application/json` - `JSON object` - **reportName** `string` - The report name echoed back from the request for identification - **data** `JSON array` - Array of row objects where each key is a column name and each value is the column value as a string - **columnDetails** `JSON array` - Array of column metadata objects describing the result set columns including name and JDBC data type ### HTTP 400 Response Body — `application/json` - `JSON object` - **errorCode** `string` - Error code for invalid query. INVALID_QUERY = the saved SQL query is syntactically invalid or fails construction during re-execution - **errorMessage** `string` - Human-readable message describing why the saved query failed validation or construction ### HTTP 401 Response Body — `application/json` - `JSON object` - **errorCode** `string` - Error code for unauthorized access. REPORT_UNAUTHORIZED = the specified report ID was not found or the user does not have permission to access it - **errorMessage** `string` - Human-readable message indicating the user is not authorized to access the specified query report ### HTTP 417 Response Body — `application/json` - `JSON object` - **errorCode** `string` - Error code for unauthorized MSP access. REPORT_UNAUTHORIZED = MSP non-admin user attempting to access query reports - **errorMessage** `string` - Human-readable message indicating the user is not authorized as an MSP admin to access query reports ### HTTP 500 Response Body — `application/json` - `JSON object` - **errorCode** `string` - Error code for server-side failure. INTERNAL_ERROR = an unexpected error occurred during query execution or report lookup (e.g., SQLException) - **errorMessage** `string` - Human-readable message describing the internal server error encountered while fetching query report data ### Possible Response Codes - `200` — HTTP code - `400` — HTTP code - `401` — HTTP code - `417` — HTTP code - `500` — HTTP code ### Sample Response: HTTP 200 Result of executing the saved query report's SQL query ```json { "reportName": "sample", "data": [ { "user_id": "1", "last_name": "null", "description": "No Description", "middle_name": "null", "first_name": "admin", "createdtime": "1774255689700" }, { "user_id": "2", "last_name": "null", "description": "No Description", "middle_name": "null", "first_name": "guest", "createdtime": "1774255689700" } ], "columnDetails": [ { "columnDataType": -5, "columnName": "user_id" }, { "columnDataType": 12, "columnName": "first_name" }, { "columnDataType": 12, "columnName": "middle_name" }, { "columnDataType": 12, "columnName": "last_name" }, { "columnDataType": -5, "columnName": "createdtime" }, { "columnDataType": 12, "columnName": "description" } ] } ``` ### Sample Response: HTTP 400 Saved SQL query is syntactically invalid or fails construction during re-execution ```json { "errorMessage": "Invalid query syntax or unsupported statement", "errorCode": "INVALID_QUERY" } ``` ### Sample Response: HTTP 401 Report ID does not exist or user does not have permission to access it ```json { "errorMessage": "You are not authorized to access this report", "errorCode": "REPORT_UNAUTHORIZED" } ``` ### Sample Response: HTTP 417 MSP non-admin user attempting to access query reports ```json { "errorMessage": "You are not authorized to access this resource", "errorCode": "REPORT_UNAUTHORIZED" } ``` ### Sample Response: HTTP 500 Unexpected error during saved query execution or report lookup ```json { "errorMessage": "An internal server error occurred while fetching query report data", "errorCode": "INTERNAL_ERROR" } ``` ## Rate Limit ![](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 30 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.